figure

Automatic saving a figure as an image file in Matlab

試著忘記壹切 提交于 2019-12-05 19:39:40
I'm creating 49 figures in Matlab, they are all created automatically one after the other. I want them to also automatically be saved as .tif or .jpg images with names corresponding to their figure number. Can I do it? And if so,how? the code for the creation of the figures is: for num_picture=0:48 ... figure (num_picture+1) imshow (screen_im) end The ... part is where all the calculations of screen_im are. I want those images in order to create a movie from them, If there is a way where I can create the movie automatically form Matlab, it would be good also, actually it will be better. You

<figure>&<figcaption> with floating image, figcaption wraps, and article text wraps around image/caption

泪湿孤枕 提交于 2019-12-05 18:33:13
Searched the web for weeks but can't find the answer that satisfies all my needs (only partial), help is very welcome. What I want and have accomplished: Plain HTML5 compliant and CSS Show an image within an article Image must have a caption Caption must below the image Caption must be limited to horizantal size of image Caption may be longer than one line and text should wrap to next line (still within size of image) Image and caption must float as a group to left or right (think of using <figure class="left"> ) Text of article must wrap around the image and caption Image size varies (first

Save Matlab figure without plotting it?

瘦欲@ 提交于 2019-12-05 18:30:00
问题 Is there a way of saving a figure plot without actually plotting it? I mean, let's say I want to save the graph for plot(1:10, (1:10).^2) , can I save it without showing it? I want to make the run time shorter by cutting off the unnecessary plotting of the figures (those will be closed anyway after saving). Thanks! 回答1: This can be done: set(gcf,'Visible','off'); plot((1:10),(1:10).^2); print -dpng c:\chris.png % or whatever your print command is 回答2: There is also the saveas(h,'filename.ext'

Reusing patch objects in matplotlib without them moving position

∥☆過路亽.° 提交于 2019-12-05 10:51:32
I want to automatically generate a series of plots which are clipped to patches. If I try and reuse a patch object, it moves position across the canvas. This script (based on an answer to a previous question by Yann) demonstrates what is happening. import pylab as plt import scipy as sp import matplotlib.patches as patches sp.random.seed(100) x = sp.random.random(100) y = sp.random.random(100) patch = patches.Circle((.75,.75),radius=.25,fc='none') def doplot(x,y,patch,count): fig = plt.figure() ax = fig.add_subplot(111) im = ax.scatter(x,y) ax.add_patch(patch) im.set_clip_path(patch) plt

Program to open .fig files saved by Matlab

ε祈祈猫儿з 提交于 2019-12-05 10:27:17
问题 Is there any program able to open .fig files saved by Matlab? 回答1: Update 29/04/2016 According to johnml1135's answer, fig files are essentially just mat files, and johnml1135 figured out where the various plot elements are stored, for converting a fig file to a Python plot. Original According to the answer here the fig file saved by Matlab is in a proprietary binary format. I don't know of any other software capable of loading this format. Your best option is probably to have the figure

Tight bounding box around PDF of MATLAB figure

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:19:26
When creating a simple figure in MATLAB and saving it as PDF, the resulting PDF file will have a luxurious bounding box. plot(1,1,'x') print(gcf, '-dpdf', 'test.pdf'); (From the ratio of the output it seems they always put in on an A page.) Is there a simple way to get a tight bounding box around the PDF? You can format the bounding box as follows figure(1) hold on; plot(1,1,'x') ps = get(gcf, 'Position'); ratio = (ps(4)-ps(2)) / (ps(3)-ps(1)) paperWidth = 10; paperHeight = paperWidth*ratio; set(gcf, 'paperunits', 'centimeters'); set(gcf, 'papersize', [paperWidth paperHeight]); set(gcf,

Removing the edge line on a contour plot

杀马特。学长 韩版系。学妹 提交于 2019-12-05 02:49:11
问题 I used Matlab to create a polar coordinate and converted it into Cartesian coordinate. [th,r] = meshgrid((0:0.5:360)*pi/180,0:.02:1); [X,Y] = pol2cart(th,r); I get data on this mesh and produce a contourf plot over it. My problem is that I get a center line in my contourf plot which I would like to remove, could some help me with this Thank you 回答1: If I extend a little bit your example to get something I can plot, I do reproduce the problem: [th,r] = meshgrid((0:0.5:360)*pi/180,0:.02:1); [X

Convert Matplotlib figure to NumPy array without any borders/frame or axis

点点圈 提交于 2019-12-04 11:08:10
I'm trying to compare a generated image in Python with an image/photo in a file. The best way I got to make this so far is by generating a figure in Matplotlib and then convert it to a numpy array and compare the values with the values I get from my image. I got the following code to convert a Matplotlib figure to a 3D numpy array with RGB channels: def fig2data ( fig ): """ @brief Convert a Matplotlib figure to a 3D numpy array with RGB channels and return it @param fig a matplotlib figure @return a numpy 3D array of RGB values """ # draw the renderer fig.canvas.draw ( ) # Get the RGBA buffer

Julia: How to save a figure without plotting/displaying it in PyPlot?

淺唱寂寞╮ 提交于 2019-12-04 09:12:53
I am using the PyPlot package in Julia to generate and save several figures. My current approach is to display the figure and then save it using savefig . using PyPlot a = rand(50,40) imshow(a) savefig("a.png") Is there a way to save the figure without having to first display it? Alexander Morley Are you using the REPL or IJulia? If you close the figure then it won't show you the plot. Is that what you want? a = rand(50,40) ioff() #turns off interactive plotting fig = figure() imshow(a) close(fig) If that doesn't work you might need to turn off interactive plotting using ioff() or change the

Matlab add text to the outside of figure

前提是你 提交于 2019-12-04 08:15:31
How do I add a text to the right of the figure? I want to resize the plot to leave some empty space on the right and add some information there. Thanks!! zachd1_618 If you want to put that text inside of a legend you can do: legend('Some quick information','location','EastOutside') That is easiest. For more control though, you can put a text box inside the figure window: MyBox = uicontrol('style','text') set(MyBox,'String','Here is a lot more information') and move it around with: set(MyBox,'Position',[xpos,ypos,xsize,ysize]) Try this for short text: plot(1:5); text(5.05, 2.5, 'outside',