python,matplotlib,figure,matplotlib-basemap

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 base_map.py that has two functions: plot() that create a map object and...

python,numpy,matplotlib,figure,python-multiprocessing

Do a matplotlib.use('agg') at the head of the script. Matplotlib appears to be trying to establish a GUI in each sub-process, which are conflicting with one-another. More generally, you may not want to use the pyplot interface, but rather the OOP one, in cases where you are not doing standard...

matlab,function,matlab-figure,figure

I think what you are after is the DefaultLineLineWidth property, to which you can assign a value for a particular figure (or the root). Here is a simple code illustrating; basically I create a figure, set its 'visible' property to 'off' and assign a default line linewidth (that sounds weird...)....

Use the multiplot feature in gnuplot to do this e.g. set terminal postscript eps enhanced color "Helvetica" 20 set output 'my_data.eps' # beginning of multiplot set multiplot # the first plot set size 1,1 set origin 0,0 set xlabel "Distance 1" set ylabel "Distance 2" set log x set log...

matlab,user-interface,layout,resize,figure

try set(fig, 'Position', [100, 100, 1049, 895]); where the values are defined as [left bottom width height]...

Very easy: just add a text object with its 'interpreter' property set to 'latex': text(.3, .5, '$\vec R=2$', 'interpreter', 'latex', 'fontsize', fontSize) The first two arguments of text are coordinates; change them as needed. ...

canvas,matplotlib,wxpython,figure,wxnotebook

Have tried the code on Windows (wxPython 2.9.5.1/mpl 1.3.1) and got the same result (red markings on the bottom of the first plot). I would tackle the problem however differently and specify the size of the plot not in matplotlib, but in wxPython. When changing the code as follows: def...

matlab,image-processing,title,matlab-figure,figure

The reason why you're getting columns undefined is due to variable scope. When you define columns in SegmentationNew, columns is only available within the lifetime of SegmentationNew and only visible within SegmentationNew. Once SegmentationNew completes, column is no longer defined. I honestly can't make heads or tails of what SegmentationNew...

To write multiple variables use plot in order to get multiple variables on the same figure follow the pattern bellow.. k1=[1 2 3 ...] f1=[34 23 12 ...] k2=[ ... ] f2=[ ... ] k3= f3= figure plot (k1,f1,k2,f2,k3,f3) EDIT 1: since your data is in vector form as shown...

The solution is to setup a figure/axis in main.py and then pass the axis handle to each module. As a minimal example, import matplotlib.pyplot as plt import numpy as np #from mod import plotsomefunction #from diffrentmod import plotsomeotherfunction def plotsomefunction(ax, x): return ax.plot(x, np.sin(x)) def plotsomeotherfunction(ax, x): return ax.plot(x,np.cos(x)) fig,...

matlab,plot,matlab-figure,figure

Try this out NumTicks = 4; L = get(gca,'XLim'); set(gca,'XTick',linspace(L(1),L(2),NumTicks)) You can easily wrap it in a function if you like....

Your problem is that when showing your figure in your program you are controlling the aspect ratio, meaning that the x-ticks do not overlap. However when saving the figure you are allowing matplotlib to automatically guess what it should be doing, and it's getting this wrong. You can use fig.set_size_inches()...

css,html5,image,figure,caption

The HTML <figcaption> Element represents a caption or a legend associated with a figure or an illustration described by the rest of the data of the <figure> element which is its immediate ancestor which means can be the first or last element inside a block. -MDN Although your current...

Okay, this should work: fig = figure('Visible', 'off'); scatter(Data(:,1),Data(:,2),'filled'); hold on; h = plot(Data(:,1),b,'-'); legend(h,sprintf('r = %s, p = %s',num2str(r),num2str(p))); title(sprintf(<plot title>)); xlabel(sprintf('%s',set1.textdata{1,z+2})); ylabel(sprintf('%s',set2.textdata{1,f+2})); hold off set(findall(fig,'type','text'),'fontSize',16,'fontweight','bold') saveas(fig,fullfile(output_path, sprintf(<filename>)); close(fig) ...

matlab,plot,screen,fullscreen,figure

I don't believe there is an easy way to do it. There are two options: First, use the position part of the subplot: >> subplot(2,5, i, [l, b, w, h]) and calculate the left, bottom, width, height. Or, get the handle of the returned axis: >> h(i) = subplot(2,5,i); and...

matlab,image-processing,matlab-figure,dicom,figure

If you want to talk about "index", we need to go into what are known as indexed images. Take for example the mandrill data set that you can load into MATLAB via: >> load mandrill You see that there is a colour map called map and an indexed image called...

python,numpy,matplotlib,figure

If you'd like the image to adjust so that it fills up the available space, specify aspect='auto' to imshow. Note that the pixels will not be square! For example: import matplotlib.pyplot as plt import numpy as np mat = np.random.rand(500,5000) plt.imshow(mat, interpolation='none', aspect='auto') plt.show() Just for comparison, the default behavior...

I am afraid you have uncovered a deficiency in the current version (0.8.1) of Bokeh. The Image glyph was move to the underlay render level, which is the same as the grid. If you pan the plot, you will see the grid is actually on, the image is just on...

First off, avoid using W3Schools please. Main reason being is that they post a lot of inaccurate information. A better place that's been evolving for web development can be found on the Mozilla Developer Network (MDN). Specifically on their <figure> page. A <figure> is basically just another HTML5 element that's...

matlab,graphics,octave,fill,figure

You can use the following trick: Fill normally, as you do in your code. No need for coloring the edges; it will be done later. Draw a white rectangular patch to cover the part you don't want filled. No edge color here either. Plot the lines on top of that....

The problem is with getframe. A detailed answer was given in this thread and in this discussion. In short you need to avoid getframe and instead do something like the following: ax = figure(1); set(ax, 'visible', 'off') set(ax, 'PaperPositionMode','auto') aviobj = avifile('file.avi'); .... for k=1:N %# all the plotting you...

Assuming the rectangles overlap, the part for the plotting could be done like this: if (A(1)<=B(1)) intersection(1)=B(1); intersection(3)=A(1)+A(3)-B(1); else intersection(1)=A(1); intersection(3)=B(1)+B(3)-A(1); end if (A(2)<=B(2)) intersection(2)=B(2); intersection(4)=A(2)+A(4)-B(2); else intersection(2)=A(2); intersection(4)=B(2)+B(4)-A(2); end intersectionPlot=rectangle('Position', intersection); set(intersectionPlot, 'FaceColor', 'r'); % r stands for red, you can choose any other color ...

Validator says it's proper structure, so yes. When it comes to semantic I don't see any problem, however always remember that in html5 you can wrap whole figure in a link which might be of use as in most of the case you want to wrap description also. I used...

A figure is a sectioning root. The first heading in any sectioning root never starts a subsection regardless of its rank, unless the heading itself appears after or within a different sectioning content element within the sectioning root, like for instance the article > h1 in your page. Here is...

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,Y] = pol2cart(th,r); Z = sqrt( X.^2 + Y.^2 ) ; isoLevel = 0:0.1:10 ; [C ,hc] = contourf(X,Y,Z,isoLevel) ; The black line at the interface is because...

As shown in the documentation, you can set the labels as follows: plt.xticks(locations, labels) If you don't want to change the tick locations, you can do: plt.xticks(plt.xticks()[0], labels) ...

Thanks to the hint from @Hoki, i solved this issue. ff is the array of n data points (x,y) with size (n*2). Because my points are within a narrow range with step 0.001, i used dx and dy with these particular values. It depends on the point steps. clf(figure(3)), hold...

You can use findobj to look for text objects, and the get the position as you would for any property of a graphics object. Example: clear clc %// Create/plot data x = -10:10; y1 = x.^2; y2 = 2*x-10; plot(x,y1,'--r',x,y2,'-*k') %// Add some text t1 = text(-6,10,'Curve 1'); t2 =...

matlab,plot,division,figure,subplot

I have come this problem many times and haven't yet figured out a decent way to solve it. However what you can do is: A) Include a Label (help label) in the subplot you want. Alternatively use a "edit locked" edit text field. B) Yes in a way. Check out...

I think this is what you are looking for. I created a dummy function that you can copy/paste and try on your side. I created a listener object for both sliders, whose callback update the position of the marker after erasing the previous marker drawn. That should work for your...

If you need it only for one session or a script, add this to the top of your script (or at the matlab command line before you plot anything): set(0, 'DefaultFigureColor', 'w'); or set(groot, 'DefaultFigureColor', 'w'); This eliminates the need for multiple set commands. If you want this to hold...

For some reason (which are not completely clear to me) the pdeplot function internally calls hold off. So, to get the desired result you need to add a hold on after each call to pdeplot....

As @joran mentioned, the bty parameter is only respected if you use "plot" type in the box() command unfortunately. You can, however, draw the lines yourself par(fig = c(.1,.9,.1,.9), plt = c(.1,.5,.1,.9)) plot(c(1,2,3),c(1,2,3)) par(fig = c(.1,.9,.1,.9), plt = c(.5,.9,.1,.9), new=T) plot(c(1,2,3),c(1,2,3)) par(fig = c(0,1,0,1), plt = c(0,1,0,1)) lines(grconvertX(c(0,0,1,1), "nfc","user"), grconvertY(c(1,0,0,1),...

If you change the Color setting of the plots, it should change the legend automatically: h = get(gca,'Children'); c = get(h,'Color'); c should be a cell array of colors. Presuming the handles are in the same order as the legend this should work: set(h(2),'Color',c{4}) set(h(4),'Color',C{2}) Handle order can change depend...

matlab,graphics,simulink,matlab-figure,figure

You can use rand(N,1) to get an N element column vector where each element is a random number between 0 and 1. Set N to be how ever many values are indicated by your "......." at the end of the post. As each cycle "(1 second)" increases an integer counter...

Have you considered using the multiprocessing module to parallelize processing the files? Assuming that you're actually CPU-bound here (meaning it's the fourier transform that's eating up most of the running time, not reading/writing the files), that should speed up execution time without actually needing to speed up the loop itself....

matlab,plot,matlab-figure,figure

Replace xlabel('Time(s)') by: xlabel('Time(s)','FontName','TimesNewRoman','FontSize',18) and do the same for ylabel. For the marker size, replace hPlot1 = plot(x,y1,'rs'); by hPlot1 = plot(x,y1,'r-',x(1:5:end),y1(1:5:end),'ks','MarkerSize',8); and the same for the other plot. Finally, you can add text to the figure using the text function, e.g.: text(0.5,1.5,'Harmonic force f(t) = sin(\omega t)') Again, you...

html5,header,semantic-markup,figure

Should I put that inside the article header instead? Yes. This is metadata about the article, not about the document, so it should be inside of article. And header is the appropriate element for this (footer might also be appropriate, as their differences aren’t strictly defined; however, I’d go...

r,matlab,animation,plot,figure

I'm not about to try to figure out what all the matlab plotting is doing w/r/t aesthetics. This: while(TRUE) { barplot(sample(1:1000, 10)) Sys.sleep(0.5) } "animates" a random bar chart display pretty well IMO and: t <- (1:360) / 180 * pi n <- length(t) x <- cos(t) y <- sin(t)...

matlab,user-interface,plot,figure

Edit: now I read your comment on the other answer, there is a faster way to do what you want. The first answer explained how to save and retrieve values from different part of your gui, but all you need in your case is to do a copy of your...

If you're open to play around with undocumented features, this can be done using the java objects behind the matlab figures, e.g. using a little tool from the fileexchange. This will create a new dock group, just like MATLAB's container for figures, editor etc....

If you are familiar with shiny you can build simple shinyApp to display file.png file in browser: Rscript -e 'png("file.png"); plot(1:10); dev.off(); runApp("display_png_app")' Good comment by @Ista: you don't need to use shiny, you can simply use browseURL("file.png") command instead runApp....

matlab,plot,matlab-figure,handle,figure

Setting the property NextPlot of the current figure to new will create a new plot on the next call to plot(). Here's a small example: plot(1:10, 1:10); % create a figure set(gcf, 'NextPlot', 'new'); % next plot goes in new figure plot(1:10, 1:10); The CurrentFigure property you tried to change...

This is from knitr website: fig.show: ('asis'; character) how to show/arrange the plots; four possible values are asis: show plots exactly in places where they were generated (as if the code were run in an R terminal) hold: hold all plots and output them in the very end of a...

python,matplotlib,plot,boxplot,figure

This should work for your example code. However this solution bypasses the sharex aligment In my opinion, the axis labeling when using box plots and sharex is a little unintuitive. %matplotlib inline import matplotlib.pylab as plt import numpy as np np.random.seed(42) # create random data for i in range(1,6): x...

matlab,plot,matlab-figure,figure

Here is an idea if I got your question right: Since MATLAB automatically resizes the axis to fit with the range of the data, you can let it set the limit for the first plot only, and then in each subsequent plot retrieve the x- and y limits and assign...

It is a simple HTML issue and has nothing to do with php, but even if you code HTML in php you could just use the <br> tag for line break. By the way, it is considered a good practice to keep all HTML tags (<a>) and attributes (href="") in...

When the MATLAB figure is open, you can use the data cursor tool to help you traverse through the plot. Here's a quick example: t = 0 : 0.01 : 10; plot(t, sin(t)); Here's what your plot looks like, and I have highlighted the option of where you can click...

matlab,resize,matlab-figure,figure,axes

Use axis command : % whatever code you have plot(x,y,'-o'); % now add limits for the axisX and axisY % that combined with the position limit should zoom your picture automatically % x1, x2, y1, y2 should be actual values like 0.5, 1, -4 etc. whatever you find appropriate %...

android,algorithm,geometry,figure

You can make a method that takes in an angle and returns the point on the boundary at that angle from the center. This involves a little trigonometry, and cases for the square. To draw a line between the boundaries of two shapes, determine the angle of the difference vector...

python,matplotlib,plot,figure,contourf

Without your data we can't see what the plot is supposed to look like, but I have some general recommendations. Don't use pylab. And if you absolutely must use it, use it within its namespace, and don't do from pylab import *. It makes for very sloppy code - for...

I was thinking about: figure { width:25%; float:left; margin:0px; text-align:center; padding:0px; } You can check it here: http://jsfiddle.net/cBkTc/3/...

python,python-2.7,matplotlib,figure,subplot

When using subplots_adjust, the values of left, right, bottom and top are to be provided as fractions of the figure width and height. In additions, all values are measured from the left and bottom edges of the figure. This is why right and top can't be lower than left and...

In order to make an element floating right "shoulder-to-shoulder", you have to put it before the content that is not floating in the HTML : <div id="my-float-left"></div> <div id="my-float-right"></div> <div id="my-not-floating-content"></div> In your case, you will have to put the .otw-sidebar-2 div above the <figure>. ...

html,css,centering,flexbox,figure

vertical-align: middle works if you set something to display: inline-block; but not any block level element. That vertical alignment will only affect items that are in text flow (which putting something as an inline-block will accomplish). However, you can do something like this: figure > img { position: absolute; top:...

I think you almost had it. Try setting xlabel, ylabel, title, and legend on ax. fig, ax = plt.subplots(figsize=(3,2.25)) ax.plot(df3['difference'],'r-',label="Observations") ax.plot(df4['difference'],'b-',label='MERRA') ax.set_xlim(0,205) ax.set_ylim(-60,60) ax.set_xlabel('Year') ax.set_ylabel('Snow Depth Departures(cm)') ax.set_title('Station '+str(stations[c])+' Snow Depth Correlations R='+str("%0.2f"%corr[0])+'') ax.autoscale(False) ax.set_xticks(np.arange(0,193,48)) ax.set_xticklabels(['1979','1983','1987','1991','1995'])...