Define a plot object but do not show the plot

I have a speradsheet
column 1 = day
column 2 = temperature
column 3 = rainfall
I want to define
plot_temperature=plot(day, temperature)
plot_rainfall=plot(day, rainfall)
But I do not want to display these two plots when I define these objects. Please advise.

 Accepted Answer

plot_temperature=plot(day, temperature, 'Visible', 'off');
plot_rainfall=plot(day, rainfall, 'Visible', 'off');
Or if you don't even want a figure to show:
f = figure('Visible', 'off');
ax = axes(f);
plot_temperature=plot(ax, day, temperature);
plot_rainfall=plot(ax, day, rainfall);

3 Comments

The idea is just to define these plot objects so that one can reuse them when one wants to plot multiple times (with different x axis, y axis, and title specifications). But the above definitions may not be portable...
So you want to write a function that accepts data and plots that data using settings you've chosen earlier? Generating code from a plot that you've created and customized so it looks the way you want is probably a good first step.
Yes this is the idea. Thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Products

Release

R2020a

Tags

Asked:

on 30 May 2020

Commented:

on 30 May 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!