figure

How to create a reusable basemap

徘徊边缘 提交于 2019-11-30 21:46:13
In continuation to my previous question: How to superimpose figures in matplotlib i would like to know how can one create a reusable basemap object. My problem is that a basemap is not a pyplot object, so the solution i received works well on figures / axes but not on basemap objects. I tried to look around and find a solution, but couldn't find any, just discussions. Shai Efrati Thanks to @JoeKington here and @EdSmith at How to superimpose figures in matplotlib , i was able to understand how to achieve what i wanted: reuse basemap objects and pass them around. I made it this way: Created a

Matlab in Linux (Ubuntu 11.10) doesn't display Unicode (Hebrew) in plot figure

时光总嘲笑我的痴心妄想 提交于 2019-11-30 19:40:44
I try to use Hebrew characters in a Matlab figure plot on my Ubuntu to no avail. I tried: text(0.6,0.5,'ירוק','fontname','times new roman','rotation',180,'fontsize',50,'color','r') and title('ירוק','fontname','times new roman','fontsize',50,'color','r') similar to what was proposed in the answer to this question . I got garbled text (see attached image ). Matlab is in version R2009b. Of course I'm set to UTF-8 encoding. >> slCharacterEncoding ans = UTF-8 I also have access to a remote computer via ssh, with version R2011a. That didn't work either. (There I had to slCharacterEncoding('UTF-8') )

How to get matplotlib figure size

会有一股神秘感。 提交于 2019-11-30 12:29:26
问题 For a project, I need to know the current size (in pixels) of my matplotlib figure, but I can't find how to do this. Does anyone know how to do this ? Thanks, Tristan 回答1: import matplotlib.plt fig = plt.figure() size = fig.get_size_inches()*fig.dpi # size in pixels To do it for the current figure, fig = plt.gcf() size = fig.get_size_inches()*fig.dpi # size in pixels You can get the same info by doing: bbox = fig.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) width, height =

How can I extract data from a .fig file in MATLAB?

无人久伴 提交于 2019-11-30 10:59:58
I know this is really basic, but I am new to MATLAB. After opening a .fig file, how do you actually work with the plotted data in the command window? All I see is the plot. I'm not sure how to actually get the data. Actually, you don't even have to display the figure in order to get the data. FIG files are stored in the standard Matlab MAT format, that you can read using the built-in load() function. The figure handles and data are stored in a structure that you can easily understand and process. Scott Hirsch Here's a really simple way: Click on the object that you want to get the data from.

MATLAB: print a figure to pdf as the figure shown in the MATLAB

牧云@^-^@ 提交于 2019-11-30 07:14:49
问题 I am trying to export (save as, print) a figure into .pdf format. However, no matter how I configure the setting, there are large margins around the figure. When I export the figure into .eps format, there is no such problem --- i.e. the figure just looks like it is displayed in the MATLAB. How could I export the figure into .pdf format, which looks the same as it is shown in the MATLAB? 回答1: You can try the following: 1) After you plot the figure in MATLAB, go to 'File->Export Setup', and

Interactive(?) plotting in Spyder with matplotlib

南楼画角 提交于 2019-11-30 07:12:22
问题 I am trying to migrate over to Python from Matlab and can't figure out how to get interactive(?) plotting working within the Spyder IDE. My test code is shown below. With the .ion() nothing happens, I get a quick flash of a figure being drawn then the window instantly closes and spits out my Hello. Without the .ion() the figure is drawn correctly but the script hangs and doesn't spit out Hello until I manually close the figure window. I would like the script to run like a matlab script would

How to save a figure in MATLAB from the command line?

拟墨画扇 提交于 2019-11-30 06:23:30
问题 Is there a command in MATLAB which allows saving a figure in FIG or JPEG or both formats automatically? 回答1: Use saveas: h=figure; plot(x,y,'-bs','Linewidth',1.4,'Markersize',10); % ... saveas(h,name,'fig') saveas(h,name,'jpg') This way, the figure is plotted, and automatically saved to '.jpg' and '.fig'. You don't need to wait for the plot to appear and click 'save as' in the menu. Way to go if you need to plot/save a lot of figures. If you really do not want to let the plot appear (it has

How to get matplotlib figure size

混江龙づ霸主 提交于 2019-11-30 05:43:01
For a project, I need to know the current size (in pixels) of my matplotlib figure, but I can't find how to do this. Does anyone know how to do this ? Thanks, Tristan import matplotlib.plt fig = plt.figure() size = fig.get_size_inches()*fig.dpi # size in pixels To do it for the current figure, fig = plt.gcf() size = fig.get_size_inches()*fig.dpi # size in pixels You can get the same info by doing: bbox = fig.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) width, height = bbox.width*fig.dpi, bbox.height*fig.dpi 来源: https://stackoverflow.com/questions/29702424/how-to-get

Subfigs of a figure on multiple pages

瘦欲@ 提交于 2019-11-30 04:39:57
I am facing problem of stacking many figures The problem is the stack figure is overriding the page dimension vertically and placing all the figure in one page and not changing the page as the limitation of page is reached. How can page be changed while stacking all the figures. \usepackage{subfig} \usepackage{float} \begin{figure}[hp] \centering \subfloat[Fig1]{\label{fig:1}\includegraphics[width=0.48\textwidth]{fig1}} \subfloat[Fig2]{\label{fig:2}\includegraphics[width=0.48\textwidth]{fig2}} \subfloat[Fig3]{\label{fig:3}\includegraphics[width=0.48\textwidth]{fig3}} \subfloat[Fig4]{\label{fig

Matlab in Linux (Ubuntu 11.10) doesn't display Unicode (Hebrew) in plot figure

℡╲_俬逩灬. 提交于 2019-11-30 03:09:43
问题 I try to use Hebrew characters in a Matlab figure plot on my Ubuntu to no avail. I tried: text(0.6,0.5,'ירוק','fontname','times new roman','rotation',180,'fontsize',50,'color','r') and title('ירוק','fontname','times new roman','fontsize',50,'color','r') similar to what was proposed in the answer to this question. I got garbled text (see attached image). Matlab is in version R2009b. Of course I'm set to UTF-8 encoding. >> slCharacterEncoding ans = UTF-8 I also have access to a remote computer