Matlab won't plot a graph of my data?
66 views (last 30 days)
Show older comments
I'm currently plotting a simple data table of excel data (a 12445 by 8 table where the first column is the x axis and the rest of the columns are multiple plots on the same graph (using the hold on function) Now I've had this issue before but this time I just can't seem to shake it - not sure if it's a glitch. I broke the code down from the more efficient script I wrote to see whether I could place breakpoints and see where the issue lay. So far I have:
x = KAcConcentrationsat130K.WaveNumber(2:12445);
y2 = KAcConcentrationsat130K.VarName2(2:12445);
figure
plot(x,y2)
title('KCH_3COO Varying Concentrations at 130K')
xlabel('Frequency (cm^-^1)')
ylabel('Absorbance')
hold on
y3 = KAcConcentrationsat130K.VarName3(2:12445);
plot(x,y3)
However, MATLAB does not plot the graph. No figure windows come up and instead it just prints every integer value of data (atleast 12000 values) out in the command window. Has anyone got an idea of how to stop it from printing the data out in the command window and plot it instead?
3 Comments
Rik
on 17 Feb 2018
I suspect that something overwrote the internal plot function, so by running the line of code below, you can find out if this is the case.
which plot
Answers (3)
Image Analyst
on 17 Feb 2018
In the command window, do this:
>> which -all plot
Tell us what you see. You might see this:
>> which -all plot
built-in (C:\Program Files\MATLAB\R2017b\toolbox\matlab\graph2d\plot)
C:\Program Files\MATLAB\R2017b\toolbox\matlab\polyfun\@polyshape\plot.m % polyshape method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\polyfun\@alphaShape\plot.m % alphaShape method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\bigdata\@tall\plot.m % tall method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\graphfun\@graph\plot.m % graph method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\graphfun\@digraph\plot.m % digraph method
C:\Program Files\MATLAB\R2017b\toolbox\signal\signal\@dspdata\plot.m % dspdata method
C:\Program Files\MATLAB\R2017b\toolbox\stats\classreg\@LinearModel\plot.m % LinearModel method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\timeseries\@timeseries\plot.m % timeseries method
If you see anything that says plot is a variable, that's a problem because it means that you made a variable with the same name as a crucial built-in function and it's using that variable instead of the built-in function. And since you didn't put the semicolon at the end of the line, it's printing all the values to the command window.
Or you could put that line of code directly into your script, before you call plot(), and see what it prints out. From the sounds of it, chances are high that you defined a variable called plot. Search for everywhere in your code that you used plot by typing control-shift-f.
5 Comments
Walter Roberson
on 19 Feb 2018
When you say the issue has come back, do you mean your code is displaying a bunch of data as indicated in your original post?
In order for the current code to be displaying a bunch of data, NaTFAcooling.WaveNumber would have to be a function that displayed data, or else title or xlabel or ylabel would have to be something different than their normal function. It would not be enough for plot to have become a variable as you have the semi-colon at the end of the line that would block output; the same for set
Eddie Murray
on 11 Aug 2023
Why Do I Get This When I Try To Run A Graph In MATLAB
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceCamera
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild
Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild
1 Comment
Image Analyst
on 11 Aug 2023
Probably an error in the program you wrote.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
See Also
Categories
Find more on Bar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!