Questions tagged [matlab-figure]

MATLAB is a high-level language and programming environment developed by MathWorks. This tag relates to the creation and manipulation of graphical plots and visualizations in MATLAB figures. For questions on the creation of graphical user interface (GUI) applications in MATLAB, consider using [tag:matlab-gui], [tag:matlab-guide] or [tag:matlab-app-designer].

MATLAB is a high-level language and programming environment developed by MathWorks.

This tag relates to the creation and manipulation of graphical plots and visualizations in MATLAB figures. For questions on the creation of graphical user interface (GUI) applications in MATLAB, consider using , or .

Additional sources of technical information on these topics include:

3812 questions
113
votes
5 answers

Automatically plot different colored lines

I'm trying to plot several kernel density estimations on the same graph, and I want them to all be different colors. I have a kludged solution using a string 'rgbcmyk' and stepping through it for each separate plot, but I start having duplicates…
Doresoom
  • 7,398
  • 14
  • 47
  • 61
92
votes
5 answers

Setting graph figure size

All I want to do is make the width greater and the height smaller. I'm just doing raster plots but this question applies to any MATLAB figure. I can manually resize it using the figure directly when it's created but I want the program to spit it…
ale
  • 11,636
  • 27
  • 92
  • 149
77
votes
7 answers

Changing Fonts Size in Matlab Plots

I want to change Font Size for xlabel, ylabel, axis size, legend font size a.k.a everything at once, is this possible? By default, font is Helvetica 10. Is there way to change this? I want to use 'FontSize',14, for x or y labels.
sosruko
  • 1,069
  • 2
  • 11
  • 13
67
votes
4 answers

How do I get the handles of all open figures in MATLAB

I have nine open figures in matlab (generated by another function) and I want to print them all to file. Does anyone know how to grab the handles of all open figures in MATLAB? I know about gcf but it doesn't seem to do what I want.
Liz
  • 673
  • 1
  • 5
  • 4
40
votes
11 answers

Automatically maximize a figure

I am creating some figures in MATLAB and automatically save them to files. The problem that by definition the images are small. A good way to solve my problem by hand is to create an image (figure), maximize it, and save to a file. I am missing this…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
36
votes
2 answers

Add custom legend without any relation to the graph

I wish to insert a legend that is not related to the graph whatsoever: figure; hold on; plot(0,0,'or'); plot(0,0,'ob'); plot(0,0,'ok'); leg = legend('red','blue','black'); Now I wish to add it to another…
jarhead
  • 1,821
  • 4
  • 26
  • 46
35
votes
3 answers

How should I update the data of a plot in Matlab?

Suppose that I want to update a plot with a new data. What method should I choose? Set the XDataSource property to some name, update the variable, and call refreshdata Erase the original plot, and call plot command again. Use Set('Xdata',...')
Andrey Rubshtein
  • 20,795
  • 11
  • 69
  • 104
29
votes
5 answers

How to draw an arrow in Matlab?

I'm trying to draw an arrow in matlab graph, without any success. Code example: function [ output_args ] = example( input_args ) figure ('Name', 'example'); x = [10 30] y = [10 30] xlim([1, 100]) ylim([1, 100]) arrow (x, y) ??? end Is there any…
user3668129
  • 4,318
  • 6
  • 45
  • 87
23
votes
3 answers

How to save MATLAB figure as JPEG using saveas() without the image coming off badly?

In a MATLAB function I am writing, I am generating a figure. The figure is displayed when the function is executed. I need to save the figure as a JPEG image. To do that, I could do File->Save As in the figure window that displays the figure. But…
GigaRohan
  • 747
  • 2
  • 8
  • 21
20
votes
2 answers

Multiple plots in one figure

I have the following code and I want to combine phase space plots into one single figure. I have coded the functions, but I don't know how to make MATLAB put them into one figure. As you see, it is the variables r, a, b, and d that changes. How do I…
user1135423
  • 203
  • 1
  • 2
  • 5
19
votes
1 answer

Redraw a figure saved in 2013b in 2014b

As MATLAB has changed its figure engine in R2014b I decided to rerun some of my code for getting better looking figures out of them. Unfortunately, the last one I have is a code that takes ages to run, and I would like to highly avoid to rerun the…
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
19
votes
5 answers

Program to open .fig files saved by Matlab

Is there any program able to open .fig files saved by Matlab?
Cleiton
  • 271
  • 2
  • 5
  • 14
16
votes
6 answers

How to add a x-axis line to a figure? (matlab)

I want to add a x-axis line at 0 to a Matlab figure so that I can compare my data to see if it is positive or negative when saving the figures to a jpg. What is the best way to do this? I know you can use line() but it just seems cumbersome…
O_O
  • 4,397
  • 18
  • 54
  • 69
16
votes
10 answers

How to export non-blurry eps images?

I'm exporting an image in Matlab using the eps format, but it smooths the image. Matlab does not blur the image using other formats such as png. I would like to know how to export a non-blurry image with eps format. Here is the resulting image using…
Gorayni
  • 606
  • 2
  • 8
  • 26
16
votes
3 answers

How to make previous inputs progressively fade out in a Matlab plot when I add new inputs

Let's say I have this very simple loop for i=1:10 [xO, yO, xA, yA, xB, yB, xC, yC] = DoSomething(i); line([xO,xA,xB,xC],[yO,yA,yB,yC]); pause(0.1); end The coordinates that I am plotting correspond to the joints of a multibody system,…
Silverman
  • 299
  • 1
  • 10
1
2 3
99 100