Plotting multiple graph in same graph
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
1 vote
Share a link to this answer
8 Comments
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
"Anything" is possible; you just have to clearly define what it is that is wanted and write logic to incorporate those items.
I don't know what "two director[ies] where in one i need all the separate graphs and in another i need to have them in one graph" means. How are directories (a file structure/storage concept) and figures/graphs related to each other?
Share a link to this comment
Using this piece of code i am saving all the separate graph in "Test_output_01" folder.
%Now saving the file in a certain directory
fileName = ['/home/ali/Master_Thesis_Ali/Test_output_01/', initialFileName, '.png'];
print(fileName, '-dpngcairo');
I just dont want to repeat the whole
for j = 1:2:size(READ,2) loop again just to plot them together.
So what i want is to tweak the loop a bit to plot & save them separately in "Test_output_01" folder and together in folder "Test_output_02".
Accept my apology if i can't make myself clear. And thanks for your help.
Share a link to this comment
Inside the loop you need both directory names and to write to each after you've drawn the specific figure that belongs in that subdirectory.
You may find structuring the code to do this simpler if you encapsulate the existing code into its own function but with another couple of inputs; a flag as to whether to create multiple plots on a single figure (hold on) or to create a figure for each data set (hold off) and the name of the directory to use for output.
Then you could simply call that function from an outer loop with the control variables as wanted and not have to try to mung internally to the function itself.
More Answers (0)
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)