You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Benjamin R. <ben...@ou...> - 2015-05-08 12:47:25
|
This question would be much more suited for the scipy mailing list. On Fri, May 8, 2015 at 2:19 AM, diffracteD <abh...@gm...> wrote: > Hi. > I have a data set like following: > x = [2.06, 2.07, 2.14, 2.09, 2.2, 2.05, 1.92, 2.06, 2.11, 2.07] > y = [171.82, 170.8, 159.59, 164.28, 169.98, 162.23, 167.37, 173.81,166.66, > 155.13] > z = [-1.41, -1.26, -1.07, -1.07, -1.46, -0.95, -0.08, -1.28, -1.2, -0.86] > > Using matplotlib, scipy.linalg.lstsq function I've got a surface-fit model. > But is it possible to print the "equation of the surface ??" > Found no clue in documentation page. > > Please help ! > thank you. > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/getting-equation-from-a-surface-fit-model-tp45490.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: diffracteD <abh...@gm...> - 2015-05-08 06:19:32
|
Hi. I have a data set like following: x = [2.06, 2.07, 2.14, 2.09, 2.2, 2.05, 1.92, 2.06, 2.11, 2.07] y = [171.82, 170.8, 159.59, 164.28, 169.98, 162.23, 167.37, 173.81,166.66, 155.13] z = [-1.41, -1.26, -1.07, -1.07, -1.46, -0.95, -0.08, -1.28, -1.2, -0.86] Using matplotlib, scipy.linalg.lstsq function I've got a surface-fit model. But is it possible to print the "equation of the surface ??" Found no clue in documentation page. Please help ! thank you. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/getting-equation-from-a-surface-fit-model-tp45490.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Sourish B. <sou...@gm...> - 2015-05-07 19:19:06
|
<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">Tom,<br> <br> I just updated to 1.4.3, and yes, the bug is still there. I am attaching the PDF and PNG outputs, the python script, as well as the output from 'python textbox_padding_pdf.py --verbose-helpful > output.txt'.<br> <br> -Sourish<br> <br> On 05/07/2015 11:19 AM, Thomas Caswell wrote:<br> </div> <blockquote cite="mid:CAA48SF-o=+ci_aj+zM1J=cTD...@ma..." type="cite"> <div dir="ltr">Sourish,<br> <br> We no longer are updating the 1.3.x releases. Can you reproduce this problem using 1.4.3? <div><br> </div> <div>Tom</div> </div> <br> <div class="gmail_quote">On Thu, May 7, 2015 at 11:14 AM Sourish Basu <<a moz-do-not-send="true" href="mailto:sou...@gm...">sou...@gm...</a>> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div bgcolor="#FFFFFF" text="#000000"> Hello,<br> <br> I have been fighting with this problem for some time. It seems that if, on a plot, I have some text inside a bounding box, it displays fine on the screen, saves OK as a PNG, but when I save the plot as a PDF the padding on the right side between the text and the box disappears. I have attached a minimal example with a text box, but this problem occurs for legends as well, if the legend text is long-ish. I am also attaching a PNG and a PDF output, as well as how the PDF shows up on my viewer. Has anyone else experienced this?<br> <br> Other relevant info:<br> <br> <b>$ uname -a</b><br> Linux Merlin 3.2.0-77-generic #114-Ubuntu SMP Tue Mar 10 17:26:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux<br> <br> <b>$ python -c 'import matplotlib; print matplotlib.__version__'</b><br> 1.3.1<br> <br> <b>Where I obtained matplotlib:</b> <br> The matplotlib SourceForge site<br> <br> <b>Customisations to </b><b>matplotlibrc:</b><br> backend : Qt4Agg<br> lines.markersize : 10 # markersize, in points<br> font.sans-serif : Ubuntu, Calibri, Liberation Sans<br> font.monospace : Consolas, Inconsolata, Ubuntu Mono, Droid Sans Mono<br> axes.color_cycle : e41a1c, 377eb8, 4daf4a, 984ea3, ff7f00, ffff33, a65628, f781bf, 999999<br> pdf.fonttype : 42 # Output Type 3 (Type3) or Type 42 (TrueType) # I have tried with fonttype=3 as well, and the bug still exists<br> <br> <b>$ python bug_test.py --verbose-helpful > output.txt</b><br> output.txt attached<br> <br> Thanks,<br> Sourish<br> <br> </div> ------------------------------------------------------------------------------<br> One dashboard for servers and applications across Physical-Virtual-Cloud<br> Widest out-of-the-box monitoring support with 50+ applications<br> Performance metrics, stats and reports that give you Actionable Insights<br> Deep dive visibility with transaction tracing using APM Insight.<br> <a moz-do-not-send="true" href="http://ad.doubleclick.net/ddm/clk/290420510;117567292;y" target="_blank">http://ad.doubleclick.net/ddm/clk/290420510;117567292;y</a>_______________________________________________<br> Matplotlib-users mailing list<br> <a moz-do-not-send="true" href="mailto:Mat...@li..." target="_blank">Mat...@li...</a><br> <a moz-do-not-send="true" href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br> </blockquote> </div> </blockquote> <br> <br> <div class="moz-signature">-- <br> <b>Q:</b> What if you strapped C4 to a boomerang? Could this be an effective weapon, or would it be as stupid as it sounds?<br> <b>A:</b> Aerodynamics aside, I’m curious what tactical advantage you’re expecting to gain by having the high explosive fly back at you if it misses the target.<br> </div> </body> </html> |
From: Thomas C. <tca...@gm...> - 2015-05-07 15:45:49
|
It is doing it every where. Also look at the tick above the 2 on the bottom it is slightly clipped. It is definitely seems worse on the top, which might be showing a fence-post issue in the clipping/Agg rendering. As the OP points out zooming in on http://matplotlib.org/mpl_examples/pylab_examples/zorder_demo_01.pdf makes it really obvious that this is the case everywhere. That said, I don't think that this is a 'bug' persay. We have to pick _some_ zorder for the frame and 2.5 is is good as any other. We do have a documentation problem as I don't know where that information is other than in the source. Tom On Thu, May 7, 2015 at 11:38 AM Benjamin Root <ben...@ou...> wrote: > But, why is it doing that only along the top edge and not the other edges > (or are my eyes that bad)? > > On Thu, May 7, 2015 at 11:30 AM, Thomas Caswell <tca...@gm...> > wrote: > >> zorder can be negative, if you want to ensure that all of your lines are >> always below all of the standard axis components simple decrease the >> zorder of the elements you want behind rather than increasing the zorder of >> the elements you want in front. >> >> @ben look at the top left of >> http://matplotlib.org/mpl_examples/pylab_examples/zorder_demo_01.hires.png >> and compare where it looks like the red and green lines are clipped. >> >> Tom >> >> On Thu, May 7, 2015 at 11:14 AM plotter <pl...@tr...> wrote: >> >>> The second example on >>> http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to >>> expose a bug, which is clearly visible in the vector version: >>> >>> The blue curve with zorder=2 is plotted below the frame and all others >>> with >>> zorder >= 3 are plotted above the frame. This is because the frame >>> zorder is >>> hardcoded to be 2.5. This behaviour is certainly unexpected by most >>> users. >>> How can one modify the mutual zorder of lines without conflicting with >>> standard axis elements? >>> >>> >>> >>> -- >>> View this message in context: >>> http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html >>> Sent from the matplotlib - users mailing list archive at Nabble.com. >>> >>> >>> ------------------------------------------------------------------------------ >>> One dashboard for servers and applications across Physical-Virtual-Cloud >>> Widest out-of-the-box monitoring support with 50+ applications >>> Performance metrics, stats and reports that give you Actionable Insights >>> Deep dive visibility with transaction tracing using APM Insight. >>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> ------------------------------------------------------------------------------ >> One dashboard for servers and applications across Physical-Virtual-Cloud >> Widest out-of-the-box monitoring support with 50+ applications >> Performance metrics, stats and reports that give you Actionable Insights >> Deep dive visibility with transaction tracing using APM Insight. >> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > |
From: Benjamin R. <ben...@ou...> - 2015-05-07 15:39:04
|
But, why is it doing that only along the top edge and not the other edges (or are my eyes that bad)? On Thu, May 7, 2015 at 11:30 AM, Thomas Caswell <tca...@gm...> wrote: > zorder can be negative, if you want to ensure that all of your lines are > always below all of the standard axis components simple decrease the > zorder of the elements you want behind rather than increasing the zorder of > the elements you want in front. > > @ben look at the top left of > http://matplotlib.org/mpl_examples/pylab_examples/zorder_demo_01.hires.png > and compare where it looks like the red and green lines are clipped. > > Tom > > On Thu, May 7, 2015 at 11:14 AM plotter <pl...@tr...> wrote: > >> The second example on >> http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to >> expose a bug, which is clearly visible in the vector version: >> >> The blue curve with zorder=2 is plotted below the frame and all others >> with >> zorder >= 3 are plotted above the frame. This is because the frame zorder >> is >> hardcoded to be 2.5. This behaviour is certainly unexpected by most users. >> How can one modify the mutual zorder of lines without conflicting with >> standard axis elements? >> >> >> >> -- >> View this message in context: >> http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> One dashboard for servers and applications across Physical-Virtual-Cloud >> Widest out-of-the-box monitoring support with 50+ applications >> Performance metrics, stats and reports that give you Actionable Insights >> Deep dive visibility with transaction tracing using APM Insight. >> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Benjamin R. <ben...@ou...> - 2015-05-07 15:36:37
|
Looks like nabble swallowed your code snippet. Here it is: ``` import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import numpy.random as rnd import numpy as np TILL = 200 # just to have an end in the for loop def SSI(t): #Simulated Serial Input T = np.asarray(t) X = np.sin(T) Y = np.cos(T) return X,Y,T t = range(0,TILL/2) plt.ion() fig = plt.figure() ax = p3.Axes3D(fig) #ax = fig.gca(projection='3d') # same result as Axes3D X,Y,T = SSI(t) g, = ax.plot(X,Y,T) # for set_data method #ax.plot(X,Y,T) # not using set_data method plt.ylim([-1.5,1.5]) plt.xlim([-1.5,1.5]) for i in range(TILL): val = rnd.random(1) t.append(val) t.pop(0) X,Y,T = SSI(t) #plt.plot(X,Y,T) g.set_data(X,Y) # #ax.set_zlim(i,i+100) # to make the time axis sliding plt.draw() #g.axes.figure.canvas.draw() # Same result as plt.draw() ``` Unfortunately, IIRC, set_data() for the 3d objects is probably not what you want. See https://github.com/matplotlib/matplotlib/issues/1483. Ben Root On Sat, May 2, 2015 at 7:05 AM, arjunascagnetto <arj...@gm...> wrote: > hi, > > > I try to make my question as clear as possible. I need to plot 2 > dimensional > data coming from the serial onto a 3d plot with the third axes made of time > flowing. > > I wrote this code (it's just one of the many tries). It's about the > plotting > only, not worring about buffer from serial etc etc... > > > > > With set_data i have a static picture, with ax.plot at every for index I > can't understand what's happening. > > any help would be really appreciate. > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/2D-data-plotted-in-a-3D-plot-by-adding-time-flow-dimension-tp45468.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Thomas C. <tca...@gm...> - 2015-05-07 15:30:54
|
zorder can be negative, if you want to ensure that all of your lines are always below all of the standard axis components simple decrease the zorder of the elements you want behind rather than increasing the zorder of the elements you want in front. @ben look at the top left of http://matplotlib.org/mpl_examples/pylab_examples/zorder_demo_01.hires.png and compare where it looks like the red and green lines are clipped. Tom On Thu, May 7, 2015 at 11:14 AM plotter <pl...@tr...> wrote: > The second example on > http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to > expose a bug, which is clearly visible in the vector version: > > The blue curve with zorder=2 is plotted below the frame and all others with > zorder >= 3 are plotted above the frame. This is because the frame zorder > is > hardcoded to be 2.5. This behaviour is certainly unexpected by most users. > How can one modify the mutual zorder of lines without conflicting with > standard axis elements? > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Benjamin R. <ben...@ou...> - 2015-05-07 15:28:32
|
A quick-n-dirty way would be to use markers via the scatter() function. Just set the facecolor to 'none', and some very large markersize value. Ben Root On Wed, Apr 8, 2015 at 12:49 PM, LowDepth <Hag...@gm...> wrote: > Hello, > > how can I plot circles or other shapes in plots which have logarithmic > axis? > I have a grid of 3 plots and want to plot some kind of sketches in the > lower > right corner of > each subplot. How should I do that? > > import numpy as np > from matplotlib import pyplot as plt > from matplotlib import gridspec > > fig = plt.figure(figsize=(6, 10)) > gs = gridspec.GridSpec(3, 1, height_ratios=[1.5, 1, 1])#, height_ratios=[2, > 1, 1]) > ax0 = plt.subplot(gs[0]) > ax1 = plt.subplot(gs[1]) > ax2 = plt.subplot(gs[2]) > plt.setp(ax_new.get_yticklabels(), visible=False) > plt.setp(ax_new.get_xticklabels(), visible=False) > ax_new = fig.add_axes([0,0,1,1], frameon=False,aspect="equal") > ax_new.axes.get_yaxis().set_visible(False) > ax_new.axes.get_xaxis().set_visible(False) > circle1=plt.Circle((0.2,0.0),0.05, color="0.8") > circle2=plt.Circle((0.4,0.0),0.05, color="0.8") > ax_new.add_artist(circle1) > ax_new.add_artist(circle2) > > ax0.semilogx(x,x**2, "k-", linewidth=2) > ax1.semilogx(x,x**3, "k--", linewidth=2) > ax2.semilogx(x,np.exp(-x)+x**4, "k-.", linewidth=2) > plt.tight_layout() > plt.show() > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/How-to-draw-circles-in-logscale-plots-tp45367.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Benjamin R. <ben...@ou...> - 2015-05-07 15:25:50
|
you can always change the zorder of the frame using set_zorder(). Are you talking about the frame of the legend or the plotting area? On Mon, Apr 6, 2015 at 11:23 AM, plotter <pl...@tr...> wrote: > The second example on > http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to > expose a bug, which is clearly visible in the vector version: > > The blue curve with zorder=2 is plotted below the frame and all others with > zorder >= 3 are plotted above the frame. This is because the frame zorder > is > hardcoded to be 2.5. This behaviour is certainly unexpected by most users. > How can one modify the mutual zorder of lines without conflicting with > standard axis elements? > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Thomas C. <tca...@gm...> - 2015-05-07 15:19:57
|
Sourish, We no longer are updating the 1.3.x releases. Can you reproduce this problem using 1.4.3? Tom On Thu, May 7, 2015 at 11:14 AM Sourish Basu <sou...@gm...> wrote: > Hello, > > I have been fighting with this problem for some time. It seems that if, on > a plot, I have some text inside a bounding box, it displays fine on the > screen, saves OK as a PNG, but when I save the plot as a PDF the padding on > the right side between the text and the box disappears. I have attached a > minimal example with a text box, but this problem occurs for legends as > well, if the legend text is long-ish. I am also attaching a PNG and a PDF > output, as well as how the PDF shows up on my viewer. Has anyone else > experienced this? > > Other relevant info: > > *$ uname -a* > Linux Merlin 3.2.0-77-generic #114-Ubuntu SMP Tue Mar 10 17:26:03 UTC 2015 > x86_64 x86_64 x86_64 GNU/Linux > > *$ python -c 'import matplotlib; print matplotlib.__version__'* > 1.3.1 > > *Where I obtained matplotlib:* > The matplotlib SourceForge site > > *Customisations to **matplotlibrc:* > backend : Qt4Agg > lines.markersize : 10 # markersize, in points > font.sans-serif : Ubuntu, Calibri, Liberation Sans > font.monospace : Consolas, Inconsolata, Ubuntu Mono, Droid Sans Mono > axes.color_cycle : e41a1c, 377eb8, 4daf4a, 984ea3, ff7f00, ffff33, a65628, > f781bf, 999999 > pdf.fonttype : 42 # Output Type 3 (Type3) or Type 42 > (TrueType) # I have tried with fonttype=3 as well, and the bug still exists > > *$ python bug_test.py --verbose-helpful > output.txt* > output.txt attached > > Thanks, > Sourish > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Martin M. <mmo...@gm...> - 2015-05-06 12:20:06
|
Thomas Caswell wrote: > winreg looks like it is for programmatic access to the windows registry which mpl uses to find fonts in windows (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/font_manager.py#L173). > > > I suspect this is a problem with pychecker being too enthusiastic about checking imports. FYI: +*six-1.9.0-r1 (06 May 2015) + + 06 May 2015; Justin Lecher <jl...@ge...> +files/six-1.9.0-winreg.patch, + +six-1.9.0-r1.ebuild, metadata.xml, six-9999.ebuild: + Backport fix for windows only modules, bug #547928 + https://bugs.gentoo.org/show_bug.cgi?id=547928 > > > Tom > > > On Tue, Apr 28, 2015, 08:14 Martin MOKREJŠ <mmo...@gm... <mailto:mmo...@gm...>> wrote: > > Hi Thomas, > thank you for your thoughts. But numpy is installed: > > $ python > Python 2.7.9 (default, Apr 10 2015, 16:21:10) > [GCC 4.9.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import pylab > >>> import numpy > >>> > > Probably you are right that the warnings (reported only by pychecker) are coming from numpy. They appear with *either* of: > > import pylab > import numpy > import matplotlib > > > But, what I really asked for was where does the _winreg come from? It happens only with any of "import pylab" or "import matplotlib". > > Martin > > Thomas Caswell wrote: > > Those look like they are coming up out of numpy. I am not familiar with gentoo, but it looks like numpy is not in the dependencies list. > > > > Tom > > > > > > On Mon, Apr 27, 2015, 16:59 Martin MOKREJŠ <mmo...@gm... <mailto:mmo...@gm...> <mailto:mmo...@gm... <mailto:mmo...@gm...>>> wrote: > > > > Hi, > > I use dev-python/matplotlib-1.4.3 and I suspect this is a recent regression in it. Can anybody reproduce this? > > > > $ pychecker test.py > > Processing module test (test.py)... > > warning: couldn't find real module for class <class 'fftpack.error'> (module name: fftpack) > > warning: couldn't find real module for class <class 'lapack_lite.LapackError'> (module name: lapack_lite) > > warning: couldn't find real module for class <type 'mtrand.RandomState'> (module name: mtrand) > > warning: couldn't find real module for class <type 'mtrand.RandomState'> (module name: mtrand) > > ImportError: No module named _winreg > > warning: couldn't find real module for class <type 'cntr.Cntr'> (module name: cntr) > > > > Warnings... > > > > test.py:3: Imported module (pylab) not used > > $ cat test.py > > #! /usr/bin/python > > > > import pylab > > $ |
From: GoogleWind <goo...@16...> - 2015-05-06 08:25:51
|
Dear Eric, Thanks for your nice answer. Exactly what I need. Best regards, Jiacong Huang -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Visulization-of-orthogonal-grid-tp45473p45476.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Eric F. <ef...@ha...> - 2015-05-06 07:33:21
|
On 2015/05/05 6:03 PM, GoogleWind wrote: > Dear all, > > Matplotlib currently support the visuliaztion of triangular mesh and > square-cell map. Is there any solutions to support the visulization of > orthogonal grid as follows, > <http://matplotlib.1069221.n5.nabble.com/file/n45473/%E6%8D%95%E8%8E%B7.png> Does pcolormesh do what you need? http://matplotlib.org/examples/pylab_examples/quadmesh_demo.html http://matplotlib.org/api/pyplot_api.html?highlight=pcolormesh#matplotlib.pyplot.pcolormesh Eric > > Thanks in advances for your hints. > > Best regards, > Jiacong Huang > --------------------------------------------------------------------------------------- > Nanjing Institute of Geography & Limnology > Chinese Academy of Sciences > 73 East Beijing Road, Nanjing 210008, China > Tel./Fax: +86-25-86882127 > Homepage: http://www.escience.cn/people/elake/index.html > > > > > -- > View this message in context: http://matplotlib.1069221.n5.nabble.com/Visulization-of-orthogonal-grid-tp45473.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: diffracteD <abh...@gm...> - 2015-05-06 06:19:35
|
Hi. I am using matplotlib to plot a wireframe over a 3D list data I have. X = [2.06, 2.07, 2.14, 2.09, 2.2, 2.05, 1.92, 2.06, 2.11, 2.07, 2.15, 2.29, 2.06, 2.09, 2.19, 2.19, 2.26, 2.15, 2.15, 2.06, 2.29, 2.27, 2.46, 2.2, 2.01, 2.11, 2.03, 2.1, 2.17, 2.1] Y = [171.82, 170.8, 159.59, 164.28, 169.98, 162.23, 167.37, 173.81, 166.66, 155.13, 156.56, 156.78, 158.15, 163.31, 150.97, 133.91, 142.36, 152.48, 138.6, 153.88, 155.13, 146.09, 147.84, 167.9, 161.82, 168.39, 163.73, 164.03, 169.33, 159.42] Z = [-1.41173660883, -1.26977354468, -1.07436015752, -1.07522326036, -1.46114949754, -0.955999769503, -0.0826570511052, -1.25171489428, -1.2005961876, -0.862264432276, -1.27266152624, -1.55152901892, -0.939999658603, -1.2470594709, 0.40793102312, -1.5375122067, -1.02404937182, -1.38113558714, -0.842054259969, -0.908694881796, -1.57965851609, -1.35631827259, -2.0568110654, -0.783657274668, -0.329844805297, -1.37033049146, -0.853410578988, -1.47048937914, -1.65570962873, -1.21419612238] I am trying to plot it using: ` *data = np.c_[cumualtive_dist,cumulative_ang,cumulative_energ] # regular grid covering the domain of the data... mn = np.min(data, axis=0) mx = np.max(data, axis=0) X,Y = np.meshgrid(np.linspace(mn[0], mx[0], 50), np.linspace(mn[1], mx[1], 50)) XX = X.flatten() YY = Y.flatten() # best-fit quadratic curve A = np.c_[np.ones(data.shape[0]), data[:,:2], np.prod(data[:,:2], axis=1), data[:,:2]**2] C,_,_,_ = scipy.linalg.lstsq(A, data[:,2]) # evaluate it on a grid Z = np.dot(np.c_[np.ones(XX.shape), XX, YY, XX*YY, XX**2, YY**2], C).reshape(X.shape) # Plot scatter-points and fitted 3D surface #----------------------------------------- fig3 = plt.figure(figsize=(10,6)) ax3 = fig3.gca(projection='3d') surf = ax3.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.5, cmap=cm.jet) #Adding a color-bar... fig3.colorbar(surf, shrink=0.6, aspect=6) #ax3.plot_wireframe(X, Y, Z, rstride=1, cstride=1, alpha=0.4) ax3.scatter(data[:,0], data[:,1], data[:,2], c='r', s=5) ax3.set_zlim3d(-5, 5) #Limiting Z-axis... * ` This code is giving a plot looks like(shown below): <http://matplotlib.1069221.n5.nabble.com/file/n45474/figure_3.png> But I was looking for a fitted-graph somewhat-looks like(however not exactly) this: <http://matplotlib.1069221.n5.nabble.com/file/n45474/wire3d_demo1.png> I mean the stretching-of-thread appearance w.r.t. distribution of points, I'm not being able to get such things in mine. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/issue-with-wireframe-plot-tp45474.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: GoogleWind <goo...@16...> - 2015-05-06 04:03:45
|
Dear all, Matplotlib currently support the visuliaztion of triangular mesh and square-cell map. Is there any solutions to support the visulization of orthogonal grid as follows, <http://matplotlib.1069221.n5.nabble.com/file/n45473/%E6%8D%95%E8%8E%B7.png> Thanks in advances for your hints. Best regards, Jiacong Huang --------------------------------------------------------------------------------------- Nanjing Institute of Geography & Limnology Chinese Academy of Sciences 73 East Beijing Road, Nanjing 210008, China Tel./Fax: +86-25-86882127 Homepage: http://www.escience.cn/people/elake/index.html -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Visulization-of-orthogonal-grid-tp45473.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Seb <sp...@gm...> - 2015-05-05 20:00:15
|
Hello, I noticed that a Basemap instance yields 1e30 when projecting lat/lon NaN coordinates. In the following, nav is a pandas data frame with navigation coordinates: llcrnrlon=np.round(np.min(nav['longitude'])) llcrnrlat=np.round(np.min(nav['latitude'])) urcrnrlon=np.round(np.max(nav['longitude'])) urcrnrlat=np.round(np.max(nav['latitude'])) lat_0=(llcrnrlat + urcrnrlat) / 2 lon_0=(llcrnrlon + urcrnrlon) / 2 lat_1=llcrnrlat + ((urcrnrlat - llcrnrlat) / 6) lat_2=urcrnrlat - ((urcrnrlat - llcrnrlat) / 6) m=Basemap(projection="aea", lon_0=lon_0, lat_0=lat_0, lat_1=lat_1, lat_2=lat_2, width=6000000, height=5000000, resolution="h") x, y = m(nav['longitude'].values, nav['latitude'].values) Wherever the coordinates are NaN in the nav object, Basemap projects them to 1e30 in x and y. Is this a bug in my Debian sid python 2.7.9 version? Thanks, -- Seb |
From: Jacob73 <dre...@gm...> - 2015-05-04 09:58:33
|
Thanks for giving this info on conference room <https://eventup.com/> updates. Well I hire a big hall for meeting and I always take care for everything in meetings. Hey do you know when it will be next meeting on financial planning? I would like to attend that. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/SciPy-2015-Conference-Updates-LAST-CALL-for-talks-4-10-extension-John-Hunter-Plotting-Contest-regist-tp45326p45469.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: arjunascagnetto <arj...@gm...> - 2015-05-02 11:05:37
|
hi, I try to make my question as clear as possible. I need to plot 2 dimensional data coming from the serial onto a 3d plot with the third axes made of time flowing. I wrote this code (it's just one of the many tries). It's about the plotting only, not worring about buffer from serial etc etc... With set_data i have a static picture, with ax.plot at every for index I can't understand what's happening. any help would be really appreciate. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/2D-data-plotted-in-a-3D-plot-by-adding-time-flow-dimension-tp45468.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Sebastian <se...@gm...> - 2015-05-01 22:20:03
|
I have the paths of the hexbins=hexbin.get_paths(), but I have generated my own counts within each of these hexbins. These counts are now in the array: "counts", that is of the same length as hexbin.get_paths(). Could someone please spell out (with lines of python code) an easy way so I can make a hexbin map for this using "matplotlib.pyplot.hexbin", with colorbar and colorbar label? with many thanks & happy labour day! - Sebastian |
From: Nicolas P. R. <Nic...@in...> - 2015-05-01 07:52:04
|
-------------------------------- Extended deadline: 15th May 2015 -------------------------------- EuroScipy 2015, the annual conference on Python in science will take place in Cambridge, UK on 26-30 August 2015. The conference features two days of tutorials followed by two days of scientific talks & posters and an extra day dedicated to developer sprints. It is the major event in Europe in the field of technical/scientific computing within the Python ecosystem. Data scientists, analysts, quants, PhD's, scientists and students from more than 20 countries attended the conference last year. The topics presented at EuroSciPy are very diverse, with a focus on advanced software engineering and original uses of Python and its scientific libraries, either in theoretical or experimental research, from both academia and the industry. Submissions for posters, talks & tutorials (beginner and advanced) are welcome on our website at http://www.euroscipy.org/2015/ Sprint proposals should be addressed directly to the organisation at eur...@py... Important dates =============== Mar 24, 2015 Call for talks, posters & tutorials Apr 30, 2015 Talk and tutorials submission deadline May 15, 2015 EXTENDED DEADLINE May 1, 2015 Registration opens May 30, 2015 Final program announced Jun 15, 2015 Early-bird registration ends Aug 26-27, 2015 Tutorials Aug 28-29, 2015 Main conference Aug 30, 2015 Sprints We look forward to an exciting conference and hope to see you in Cambridge The EuroSciPy 2015 Team - http://www.euroscipy.org/2015/ |
From: Courtenay G. \(Enthought\) <cgo...@en...> - 2015-04-30 18:25:05
|
**The <https://plus.google.com/s/%23SciPy2015> #SciPy2015 Conference (Scientific Computing with <https://plus.google.com/s/%23Python> #Python) Tutorial Schedule is up! It is 1st come, 1st served and already 30% sold out. Register today!** http://www.scipy2015.scipy.org/ehome/115969/289057/? <http://www.scipy2015.scipy.org/ehome/115969/289057/?&> &.This year you can choose from 16 different SciPy tutorials OR select the 2 day Software Carpentry course on scientific Python that assumes some programming experience but no Python knowledge. Please share! Tutorials include: *Introduction to NumPy (Beginner) *Machine Learning with Scikit-Learn (Intermediate) *Cython: Blend of the Best of Python and C/++ (Intermediate) *Image Analysis in Python with SciPy and Scikit-Image (Intermediate) *Analyzing and Manipulating Data with Pandas (Beginner) *Machine Learning with Scikit-Learn (Advanced) *Building Python Data Applications with Blaze and Bokeh (Intermediate) *Multibody Dynamics and Control with Python (Intermediate) *Anatomy of Matplotlib (Beginner) *Computational Statistics I (Intermediate) *Efficient Python for High-Performance Parallel Computing (Intermediate) *Geospatial Data with Open Source Tools in Python (Intermediate) *Decorating Drones: Using Drones to Delve Deeper into Intermediate Python (Intermediate) *Computational Statistics II (Intermediate) *Modern Optimization Methods in Python (Advanced) *Jupyter Advanced Topics Tutorial (Advanced) |
From: Christian A. <am...@ym...> - 2015-04-30 15:15:45
|
I just managed to read Thomas post on stackoverflow citation. Yes, it covers, exactly what I found. This would have help if I would have found earlier. @Ben:As I said, it's nice to see such implementation but it's offside the task and offside the suggested components to use. It doesn't cover the issues I had to deal with. I am not disregarding it! But if you have to use a gui built with Qt Designer to decouple gui design which might be given as task to someone else so you can focus on implementing the functional parts, and somewhat later, someone shall improve the design, this way of creating things has the advantage that proceeding the work, if one stops working for the project, is as easy as it should be.You can split the work to gain more development speed, which is an advantage, too. Keeping the functional part away from the gui itself, enables one to improve the design without touching the functional code and without changing it's revision number if version control systems are used. Code recycling is a third one. I don't see any drawback, yet, if you don't take into account that they may be something missing in the additional libraries and the gab might cause problems not solvable.But that's not the topic of this thread. Yes, Qt Designer just provides only the framework, which than can be filled with content, for example, coming from matplotlib. Having just a dummy widget to fill as interface pays respect to being most flexible. No, having to re-initiate the mouse because it is disabled from matplotlib due to an empty canvas is not wrong but a design decision. One could have easily decided to not disable it, but the ones who wrote that part might have thought, that if the canvas is empty,you don't need axes to rotate. They discovered that this thoughts lead to problems and build a workaround enabling to switch it on again, rather than change the default. That's ok for me, because it was there decision. I would have like to find any hint about that in books, tutorials or stuff like that, but that seems to be a not that often regarded problem. I took your objection about adding the axis before the canvas is build and changed the code so after creating the figure I'm adding it to the canvas so it won't be empty anymore. This is a better way and is avoiding the mouse issue.Yes, it's clear now, but that is what I asked for in the first place. I mentioned that there may be something out of correct order. Now we know what it was and I fixed it. I like this kind of discussion which clarify the understanding, because you can get them from books. So thank you very much for the talk. I think I'm going to review the part where all the figures are created and will put them into a method which builds them if needed. That would clean up the design and the code, too.But that's something for after the deadline, for which the code can be as ugly as it is. It just has to work to get my job contract renewed. cheers,Christian -- "A little learning never caused anyone's head to explode!" "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" |
From: Benjamin R. <ben...@ou...> - 2015-04-29 19:37:15
|
Christian (again, keeping things on-list), The entire point of the example was to provide a proof of concept and to show the absolute minimum needed to get mplot3d embedded. Please do not disregard it because I did not use Qt Designer. If I understand Qt Designer correctly, it merely provides additional widgets to be included in the app, so the figure really doesn't care about that stuff and should be completely orthogonal to our problem. When you run the example I gave you, it works without any need to call mouse_init(). The fact that it works without any call to mouse_init() proves that something is going very wrong in your code. The only reason for it to be called by the user is if the user managed to disable the user interactions and needs to restore it. That should never happen unless the user explicitly makes that happen. What I see in your code is you creating the axes before creating the figure canvas. Look at my example closely. The order of the commands matter. If you are creating axes objects in a figure, and then adding a canvas, you are overwriting the auto-generated canvas that was implicitly created when you added axes objects. That is why you are losing interactivity, because all of the original callbacks were being attached to the original canvas that you overwrote. This was also noted in the SO link that Thomas gave you. I hope that clarifies things for you, Ben Root On Wed, Apr 29, 2015 at 3:12 PM, Christian Ambros <am...@ym...> wrote: > Nice, but not close to the task on hand, because no Qt Designer was used, > so no gui-elements from there, no embedding! And that was the point to all > this. > > But maybe I'v come up with a solution to my problem... > Your remember the lines: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *def main(argv): app = QtWidgets.QApplication(argv) mainwindow = > Main() mainwindow.show() fig1 = Figure() #ax1f1 = > fig1.add_subplot(111) fname='augtr_16MnCrS5.dat' arr = > np.genfromtxt(fname, delimiter=' ', usecols=(0,4,25), missing_values={0:' > '}, filling_values={0:0}, unpack=True) > #ax1f1.plot(np.random.rand(20)) #ax1f1.plot(arr(0,25)) #fig = > plt.figure() ax1f1 = fig1.add_subplot(111, projection='3d') Y, Z, X = > arr ax1f1.plot_wireframe(X, Y, Z, rstride=10, cstride=10) > #plt.show() fig2 = Figure() ax1f2 = fig2.add_subplot(211) > ax1f2.plot(Y, Z) #np.random.rand(10) ax2f2 = fig2.add_subplot(212) > ax2f2.plot(Y, X)#np.random.rand(10) fig3 = Figure() ax1f3 = > fig3.add_subplot(111) ax1f3.pcolormesh(np.random.rand(20,20)) > mainwindow.addmpl(fig1) mainwindow.addfig('figure 1', fig1) > mainwindow.addfig('figure 2', fig2) mainwindow.addfig('figure 3', > fig3) #input() #mainwindow.rmmpl() #mainwindow.addmpl(fig2) > #mainwindow.addfig('figure 2', fig2) sys.exit(app.exec_())* > > Let's take a look at the important part: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *def main(argv): app = QtWidgets.QApplication(argv) mainwindow = > Main() mainwindow.show() fig1 = Figure() #ax1f1 = > fig1.add_subplot(111) fname='augtr_16MnCrS5.dat' arr = > np.genfromtxt(fname, delimiter=' ', usecols=(0,4,25), missing_values={0:' > '}, filling_values={0:0}, unpack=True) > #ax1f1.plot(np.random.rand(20)) #ax1f1.plot(arr(0,25)) #fig = > plt.figure() ax1f1 = fig1.add_subplot(111, projection='3d') Y, Z, X = > arr ax1f1.plot_wireframe(X, Y, Z, rstride=10, cstride=10) > #plt.show() fig2 = Figure() ax1f2 = fig2.add_subplot(211) > ax1f2.plot(Y, Z) #np.random.rand(10) ax2f2 = fig2.add_subplot(212) > ax2f2.plot(Y, X)#np.random.rand(10) fig3 = Figure() ax1f3 = > fig3.add_subplot(111) ax1f3.pcolormesh(np.random.rand(20,20)) > mainwindow.addmpl(fig1) mainwindow.addfig('figure 1', fig1) > mainwindow.addfig('figure 2', fig2) mainwindow.addfig('figure 3', > fig3) #input() #mainwindow.rmmpl() #mainwindow.addmpl(fig2) > #mainwindow.addfig('figure 2', fig2) sys.exit(app.exec_())* > ... and skip the rest... > > if I just initialize the mouse upon the axis like this: > > fig1 = Figure() > fname='augtr_16MnCrS5.dat' > arr = np.genfromtxt(fname, delimiter=' ', usecols=(0,4,25), > missing_values={0:' '}, filling_values={0:0}, unpack=True) > ax1f1 = fig1.add_subplot(111, projection='3d') > Y, Z, X = arr > > mainwindow.addmpl(fig1) > ax1f1.mouse_init() > > ax1f1.plot_wireframe(X, Y, Z, rstride=10, cstride=10) > > than mouse rotation is back online, no warning, no error. > > As I asked at the beginning, it was just the right place where the > mouse_init() has to be put. > It bothered me so much that I dug into API again and searched for > mouse_init(). Taking the error message into account, "mouse rotation off" I > figured out that it's an axis problem. It's not the canvas which is > rotated, it's all about the axis, so I found the usage for the mouse_init(). > > Thank you very much for all your effort and the patience to go this way > with me. > > At last I have a good advice for you: Go and switch to using Qt Designer > and PyQt5, it really helps having good gui's for the uninitiated. > > cheers, > Christian > > Ps: I'll get back to you, when I'm done reading your book completely. > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Wednesday, April 29, 2015 1:46 PM, Benjamin Root <ben...@ou...> > wrote: > > > Here is a proof of concept (yes, it uses qt4... my work computer doesn't > have qt5, but that should be a straight-forward modification to make). Note > the complete lack of any call to mouse_init() and the complete lack of any > use of pyplot (in fact, I commented it out to make the point that you > shouldn't use pyplot *at all* when doing this sort of embedding). > > ``` > import numpy as np > #import matplotlib.pyplot as plt > import sys > from matplotlib.backends.qt4_compat import QtGui, QtCore > from matplotlib.figure import Figure > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > FigureCanvas > > from mpl_toolkits.mplot3d import Axes3D > > > if __name__ == '__main__': > # Must come before any Qt widgets are made > app = QtGui.QApplication(sys.argv) > win = QtGui.QMainWindow() > fig = Figure() > canvas = FigureCanvas(fig) > ax = fig.add_subplot(1, 1, 1, projection='3d') > > xs = np.random.rand(25) > ys = np.random.rand(25) > zs = np.random.rand(25) > ax.scatter(xs, ys, zs) > > win.resize(int(fig.bbox.width), int(fig.bbox.height)) > win.setWindowTitle("Embedding with Qt") > # Needed for keyboard events > canvas.setFocusPolicy(QtCore.Qt.StrongFocus) > canvas.setFocus() > win.setCentralWidget(canvas) > win.show() > sys.exit(app.exec_()) > ``` > > I hope this helps! > Ben Root > > > On Wed, Apr 29, 2015 at 5:38 AM, Christian Ambros <am...@ym...> > wrote: > > Ok, back from revision... > > The is no mix-up for the show command. The only explicit show() command is > commented out in line 41. It can be deleted. But I haven't done that, yet. > There are several bits of code which are remains of the design process > since this is work in progress. Code cleaning will be done when the main > functionality is in place. > > Back to addmpl where I embedded gui elements into the canvas. Taking out > the matplotlib taskbar doesn't change a thing as I wrote earlier, but to > make sure it doesn't bother the mainloop, it should be commented out. I may > not put it back in, because I don't see the point in needing it. It was > just to see if it's possible. > > >>But option 2 relinquishes that control to the developer's GUI app. You > *cannot* use pyplot for option 2, which is what you are doing. > > Is that so? In line 116 I create the canvas, which is derived from > matplotlib's backend's FigureCanvasQTAgg and given to the QWidget at line > 119. That's the only part where both interact with each other. the rest is > handle by matplotlib. > > The error message says that Axes3D.figure.canvas is 'None' and that's why > mouse rotation is disabled. > It's None because there is no content at that point, when it's passed to > the QWidget. It's filled with content in line 38. So if matplotlib disables > the mouse rotation by default, when the canvas is empty how do I prevent > this disabling by default? > If I can't, at what point do I have to pass the filled canvas to the > QWidget? How does that impact the GUI itself? > If I can't enable the mouse rotation by hand and I just can pass filled > canvas around, do I have to build a work around with initialize it with an > empty 2D canvas and replace it later with the filled 3D canvas? How's the > mouse rotation activated then? > > In general, I wouldn't have to enable the rotation if it wouldn't be > switch off for an empty canvas. > > I'm going to consult your book, now, for different ways of coping with > such things... > > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 8:28 PM, Benjamin Root <ben...@ou...> > wrote: > > > One thing I see off the bat is your addmpl() method: > > ``` > def addmpl(self, fig): > #FigureCanvas.__init__(self, fig) > self.canvas = FigureCanvas(fig) > > Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2) > self.mplvl.addWidget(self.canvas) > self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) > self.mplvl.addWidget(self.toolbar) > ``` > > You are calling Axes3D.mouse_init() on the Main object (that is `self`). > That is completely wrong. It can only be called for the 3d axes objects. > > Also, what I see happening here is some mixing up of how to do embedding. > There are two approaches to embedding. 1) you can embedded GUI elements > into your canvas widget, or 2) you can embed your canvas widget into your > GUI app. The important distinction between the two is who controls the > mainloop. In option 1 (and in matplotlib in general), pyplot will create > the GUI app for you automatically (it is completely transparent to you) and > kicks it off upon call to show(). But option 2 relinquishes that control to > the developer's GUI app. You *cannot* use pyplot for option 2, which is > what you are doing. Rip out all of the pyplot stuff, and instantiate the > Qt5 Figure object directly, and then obtain the axes objects from the > figure object via calls to add_subplot(). You shouldn't even need to do the > whole mouse_init() stuff. > > I now think this has nothing to do with Qt Designer. While I don't > specifically cover qt5 in my book, I do make all of these distinctions very > clear in chapter 5 of my book "Interactive Applications using Matplotlib". > > Cheers! > Ben Root > > > On Tue, Apr 28, 2015 at 4:03 PM, Christian Ambros <am...@ym...> > wrote: > > Hi Benjamin, > > I would do that if my task were my private stuff, but in this case it's > work-related and my boss wants me to use the designer and he already set a > deadline, which, I already knew, is set to tight. I told him before, that > it would be just a try but he sold it to his boss after some pressure. You > know how the bosses' bosses are, they don't get the idea that innovation > can't be dictated. They don't understand the concept that software is > written and doesn't come into existence out of nothing. > > Without PyQt5 it's working fine. I got the plots and they are gorgeous, > but that doesn't help when presenting to the bosses. If I just would know > how to activate the 3d-draw's mouse action again, by hand, than it has to > last just some moments for the presentation, afterwards I have the time to > examine and find a more robust solution. > > Thanks for the effort. > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 7:30 PM, Benjamin Root <ben...@ou...> > wrote: > > > I think there is something wrong with the embedding code rather than there > being an actual bug. I have embedded mplot3d stuff before (admittedly, not > in qt5) with no problems. I haven't had the time yet to examine your code > to see what the potential issue is, though. I have also never used Qt > designer, so I have no clue if there is something that it is doing that > might be making things difficult. > > I already know that the code you originally posted has errors in it. I > would suggest first making a prototype without Qt Designer as a > proof-of-concept, perhaps starting with one of our examples in the gallery? > > Ben Root > > > On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros <am...@ym...> > wrote: > > Since there seems to be no progress with this issue, may I assume there > isn't any interest in it? > I took a further look around in the internet but couldn't any solution. > It leads to an other question: How many users of matplotlib are using > 3d-plots anyway? It we are just a few and there won't be anyone who wants > to embed it in PyQt5, than I can understand that this issue doesn't concern > no-one and I have to look somewhere else to find a 3d-plotting lib which is > embedable. > > cheers, > Christain > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 21, 2015 1:44 PM, Benjamin Root <ben...@ou...> > wrote: > > > The addmpl() method isn't right. You created a canvas object, assigned it > to self.canvas, but then tried to call FigureCanvas.__init__(), passing it > whatever object "self" is. What class is addmpl() a part of? What does it > subclass? > > On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros <am...@ym...> > wrote: > > Hi, > > I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get > the following error: > > /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: > UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled. Set > canvas then call Axes3D.mouse_init(). > warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation > disabled. Set canvas then call Axes3D.mouse_init().') > > From Stackoverflow, which host to question about this, I know that mouse > actions are disabled when the canvas is re-initialized by whatever. > > The only position I do such an operation is in here: > > > > > > > > *def addmpl(self, fig): self.canvas = FigureCanvas(fig) > #FigureCanvas.__init__(self, fig) #Axes3D.mouse_init(self) > self.mplvl.addWidget(self.canvas) self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) self.mplvl.addWidget(self.toolbar)* > > On of the Stackoverflow suggestion says, that re initializing FigureCanvas > should do the trick but I'll get: > > Traceback (most recent call last): > File "./ex_0.1.py", line 145, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 116, in addmpl > FigureCanvas.__init__(self, fig) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py", > line 181, in __init__ > FigureCanvasQT.__init__(self, figure) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py", > line 237, in __init__ > super(FigureCanvasQT, self).__init__(figure=figure) > TypeError: super(type, obj): obj must be an instance or subtype of type > > as follow-up error message. > > just using *Axes3D.mouse_init()* , as suggested by matplotlib itself, > leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init() > TypeError: mouse_init() missing 1 required positional argument: 'self' > > adding self leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init(self) > File > "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py", > line 1002, in mouse_init > canv = self.figure.canvas > AttributeError: 'Main' object has no attribute 'figure' > ./ex_0.1.py & > > Maybe I'm adding those lines at the wrong place, but I could fined > anything useful in the matplotlib documantation, that would help me out, > either. > > Any thougts that might help? > > Cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live > exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- > event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > > > |
From: Thomas C. <tca...@gm...> - 2015-04-29 13:47:44
|
I think that this SO answer may be relevant: https://stackoverflow.com/questions/18259350/embed-an-interactive-3d-plot-in-pyside/18278457#18278457 On Wed, Apr 29, 2015 at 5:43 AM Christian Ambros <am...@ym...> wrote: > Ok, back from revision... > > The is no mix-up for the show command. The only explicit show() command is > commented out in line 41. It can be deleted. But I haven't done that, yet. > There are several bits of code which are remains of the design process > since this is work in progress. Code cleaning will be done when the main > functionality is in place. > > Back to addmpl where I embedded gui elements into the canvas. Taking out > the matplotlib taskbar doesn't change a thing as I wrote earlier, but to > make sure it doesn't bother the mainloop, it should be commented out. I may > not put it back in, because I don't see the point in needing it. It was > just to see if it's possible. > > >>But option 2 relinquishes that control to the developer's GUI app. You > *cannot* use pyplot for option 2, which is what you are doing. > > Is that so? In line 116 I create the canvas, which is derived from > matplotlib's backend's FigureCanvasQTAgg and given to the QWidget at line > 119. That's the only part where both interact with each other. the rest is > handle by matplotlib. > > The error message says that Axes3D.figure.canvas is 'None' and that's why > mouse rotation is disabled. > It's None because there is no content at that point, when it's passed to > the QWidget. It's filled with content in line 38. So if matplotlib disables > the mouse rotation by default, when the canvas is empty how do I prevent > this disabling by default? > If I can't, at what point do I have to pass the filled canvas to the > QWidget? How does that impact the GUI itself? > If I can't enable the mouse rotation by hand and I just can pass filled > canvas around, do I have to build a work around with initialize it with an > empty 2D canvas and replace it later with the filled 3D canvas? How's the > mouse rotation activated then? > > In general, I wouldn't have to enable the rotation if it wouldn't be > switch off for an empty canvas. > > I'm going to consult your book, now, for different ways of coping with > such things... > > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 8:28 PM, Benjamin Root <ben...@ou...> > wrote: > > > One thing I see off the bat is your addmpl() method: > > ``` > def addmpl(self, fig): > #FigureCanvas.__init__(self, fig) > self.canvas = FigureCanvas(fig) > > Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2) > self.mplvl.addWidget(self.canvas) > self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) > self.mplvl.addWidget(self.toolbar) > ``` > > You are calling Axes3D.mouse_init() on the Main object (that is `self`). > That is completely wrong. It can only be called for the 3d axes objects. > > Also, what I see happening here is some mixing up of how to do embedding. > There are two approaches to embedding. 1) you can embedded GUI elements > into your canvas widget, or 2) you can embed your canvas widget into your > GUI app. The important distinction between the two is who controls the > mainloop. In option 1 (and in matplotlib in general), pyplot will create > the GUI app for you automatically (it is completely transparent to you) and > kicks it off upon call to show(). But option 2 relinquishes that control to > the developer's GUI app. You *cannot* use pyplot for option 2, which is > what you are doing. Rip out all of the pyplot stuff, and instantiate the > Qt5 Figure object directly, and then obtain the axes objects from the > figure object via calls to add_subplot(). You shouldn't even need to do the > whole mouse_init() stuff. > > I now think this has nothing to do with Qt Designer. While I don't > specifically cover qt5 in my book, I do make all of these distinctions very > clear in chapter 5 of my book "Interactive Applications using Matplotlib". > > Cheers! > Ben Root > > > On Tue, Apr 28, 2015 at 4:03 PM, Christian Ambros <am...@ym...> > wrote: > > Hi Benjamin, > > I would do that if my task were my private stuff, but in this case it's > work-related and my boss wants me to use the designer and he already set a > deadline, which, I already knew, is set to tight. I told him before, that > it would be just a try but he sold it to his boss after some pressure. You > know how the bosses' bosses are, they don't get the idea that innovation > can't be dictated. They don't understand the concept that software is > written and doesn't come into existence out of nothing. > > Without PyQt5 it's working fine. I got the plots and they are gorgeous, > but that doesn't help when presenting to the bosses. If I just would know > how to activate the 3d-draw's mouse action again, by hand, than it has to > last just some moments for the presentation, afterwards I have the time to > examine and find a more robust solution. > > Thanks for the effort. > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 7:30 PM, Benjamin Root <ben...@ou...> > wrote: > > > I think there is something wrong with the embedding code rather than there > being an actual bug. I have embedded mplot3d stuff before (admittedly, not > in qt5) with no problems. I haven't had the time yet to examine your code > to see what the potential issue is, though. I have also never used Qt > designer, so I have no clue if there is something that it is doing that > might be making things difficult. > > I already know that the code you originally posted has errors in it. I > would suggest first making a prototype without Qt Designer as a > proof-of-concept, perhaps starting with one of our examples in the gallery? > > Ben Root > > > On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros <am...@ym...> > wrote: > > Since there seems to be no progress with this issue, may I assume there > isn't any interest in it? > I took a further look around in the internet but couldn't any solution. > It leads to an other question: How many users of matplotlib are using > 3d-plots anyway? It we are just a few and there won't be anyone who wants > to embed it in PyQt5, than I can understand that this issue doesn't concern > no-one and I have to look somewhere else to find a 3d-plotting lib which is > embedable. > > cheers, > Christain > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 21, 2015 1:44 PM, Benjamin Root <ben...@ou...> > wrote: > > > The addmpl() method isn't right. You created a canvas object, assigned it > to self.canvas, but then tried to call FigureCanvas.__init__(), passing it > whatever object "self" is. What class is addmpl() a part of? What does it > subclass? > > On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros <am...@ym...> > wrote: > > Hi, > > I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get > the following error: > > /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: > UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled. Set > canvas then call Axes3D.mouse_init(). > warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation > disabled. Set canvas then call Axes3D.mouse_init().') > > From Stackoverflow, which host to question about this, I know that mouse > actions are disabled when the canvas is re-initialized by whatever. > > The only position I do such an operation is in here: > > > > > > > > *def addmpl(self, fig): self.canvas = FigureCanvas(fig) > #FigureCanvas.__init__(self, fig) #Axes3D.mouse_init(self) > self.mplvl.addWidget(self.canvas) self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) self.mplvl.addWidget(self.toolbar)* > > On of the Stackoverflow suggestion says, that re initializing FigureCanvas > should do the trick but I'll get: > > Traceback (most recent call last): > File "./ex_0.1.py", line 145, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 116, in addmpl > FigureCanvas.__init__(self, fig) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py", > line 181, in __init__ > FigureCanvasQT.__init__(self, figure) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py", > line 237, in __init__ > super(FigureCanvasQT, self).__init__(figure=figure) > TypeError: super(type, obj): obj must be an instance or subtype of type > > as follow-up error message. > > just using *Axes3D.mouse_init()* , as suggested by matplotlib itself, > leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init() > TypeError: mouse_init() missing 1 required positional argument: 'self' > > adding self leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init(self) > File > "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py", > line 1002, in mouse_init > canv = self.figure.canvas > AttributeError: 'Main' object has no attribute 'figure' > ./ex_0.1.py & > > Maybe I'm adding those lines at the wrong place, but I could fined > anything useful in the matplotlib documantation, that would help me out, > either. > > Any thougts that might help? > > Cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live > exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- > event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Benjamin R. <ben...@ou...> - 2015-04-29 13:46:48
|
Here is a proof of concept (yes, it uses qt4... my work computer doesn't have qt5, but that should be a straight-forward modification to make). Note the complete lack of any call to mouse_init() and the complete lack of any use of pyplot (in fact, I commented it out to make the point that you shouldn't use pyplot *at all* when doing this sort of embedding). ``` import numpy as np #import matplotlib.pyplot as plt import sys from matplotlib.backends.qt4_compat import QtGui, QtCore from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from mpl_toolkits.mplot3d import Axes3D if __name__ == '__main__': # Must come before any Qt widgets are made app = QtGui.QApplication(sys.argv) win = QtGui.QMainWindow() fig = Figure() canvas = FigureCanvas(fig) ax = fig.add_subplot(1, 1, 1, projection='3d') xs = np.random.rand(25) ys = np.random.rand(25) zs = np.random.rand(25) ax.scatter(xs, ys, zs) win.resize(int(fig.bbox.width), int(fig.bbox.height)) win.setWindowTitle("Embedding with Qt") # Needed for keyboard events canvas.setFocusPolicy(QtCore.Qt.StrongFocus) canvas.setFocus() win.setCentralWidget(canvas) win.show() sys.exit(app.exec_()) ``` I hope this helps! Ben Root On Wed, Apr 29, 2015 at 5:38 AM, Christian Ambros <am...@ym...> wrote: > Ok, back from revision... > > The is no mix-up for the show command. The only explicit show() command is > commented out in line 41. It can be deleted. But I haven't done that, yet. > There are several bits of code which are remains of the design process > since this is work in progress. Code cleaning will be done when the main > functionality is in place. > > Back to addmpl where I embedded gui elements into the canvas. Taking out > the matplotlib taskbar doesn't change a thing as I wrote earlier, but to > make sure it doesn't bother the mainloop, it should be commented out. I may > not put it back in, because I don't see the point in needing it. It was > just to see if it's possible. > > >>But option 2 relinquishes that control to the developer's GUI app. You > *cannot* use pyplot for option 2, which is what you are doing. > > Is that so? In line 116 I create the canvas, which is derived from > matplotlib's backend's FigureCanvasQTAgg and given to the QWidget at line > 119. That's the only part where both interact with each other. the rest is > handle by matplotlib. > > The error message says that Axes3D.figure.canvas is 'None' and that's why > mouse rotation is disabled. > It's None because there is no content at that point, when it's passed to > the QWidget. It's filled with content in line 38. So if matplotlib disables > the mouse rotation by default, when the canvas is empty how do I prevent > this disabling by default? > If I can't, at what point do I have to pass the filled canvas to the > QWidget? How does that impact the GUI itself? > If I can't enable the mouse rotation by hand and I just can pass filled > canvas around, do I have to build a work around with initialize it with an > empty 2D canvas and replace it later with the filled 3D canvas? How's the > mouse rotation activated then? > > In general, I wouldn't have to enable the rotation if it wouldn't be > switch off for an empty canvas. > > I'm going to consult your book, now, for different ways of coping with > such things... > > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 8:28 PM, Benjamin Root <ben...@ou...> > wrote: > > > One thing I see off the bat is your addmpl() method: > > ``` > def addmpl(self, fig): > #FigureCanvas.__init__(self, fig) > self.canvas = FigureCanvas(fig) > > Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2) > self.mplvl.addWidget(self.canvas) > self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) > self.mplvl.addWidget(self.toolbar) > ``` > > You are calling Axes3D.mouse_init() on the Main object (that is `self`). > That is completely wrong. It can only be called for the 3d axes objects. > > Also, what I see happening here is some mixing up of how to do embedding. > There are two approaches to embedding. 1) you can embedded GUI elements > into your canvas widget, or 2) you can embed your canvas widget into your > GUI app. The important distinction between the two is who controls the > mainloop. In option 1 (and in matplotlib in general), pyplot will create > the GUI app for you automatically (it is completely transparent to you) and > kicks it off upon call to show(). But option 2 relinquishes that control to > the developer's GUI app. You *cannot* use pyplot for option 2, which is > what you are doing. Rip out all of the pyplot stuff, and instantiate the > Qt5 Figure object directly, and then obtain the axes objects from the > figure object via calls to add_subplot(). You shouldn't even need to do the > whole mouse_init() stuff. > > I now think this has nothing to do with Qt Designer. While I don't > specifically cover qt5 in my book, I do make all of these distinctions very > clear in chapter 5 of my book "Interactive Applications using Matplotlib". > > Cheers! > Ben Root > > > On Tue, Apr 28, 2015 at 4:03 PM, Christian Ambros <am...@ym...> > wrote: > > Hi Benjamin, > > I would do that if my task were my private stuff, but in this case it's > work-related and my boss wants me to use the designer and he already set a > deadline, which, I already knew, is set to tight. I told him before, that > it would be just a try but he sold it to his boss after some pressure. You > know how the bosses' bosses are, they don't get the idea that innovation > can't be dictated. They don't understand the concept that software is > written and doesn't come into existence out of nothing. > > Without PyQt5 it's working fine. I got the plots and they are gorgeous, > but that doesn't help when presenting to the bosses. If I just would know > how to activate the 3d-draw's mouse action again, by hand, than it has to > last just some moments for the presentation, afterwards I have the time to > examine and find a more robust solution. > > Thanks for the effort. > cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 28, 2015 7:30 PM, Benjamin Root <ben...@ou...> > wrote: > > > I think there is something wrong with the embedding code rather than there > being an actual bug. I have embedded mplot3d stuff before (admittedly, not > in qt5) with no problems. I haven't had the time yet to examine your code > to see what the potential issue is, though. I have also never used Qt > designer, so I have no clue if there is something that it is doing that > might be making things difficult. > > I already know that the code you originally posted has errors in it. I > would suggest first making a prototype without Qt Designer as a > proof-of-concept, perhaps starting with one of our examples in the gallery? > > Ben Root > > > On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros <am...@ym...> > wrote: > > Since there seems to be no progress with this issue, may I assume there > isn't any interest in it? > I took a further look around in the internet but couldn't any solution. > It leads to an other question: How many users of matplotlib are using > 3d-plots anyway? It we are just a few and there won't be anyone who wants > to embed it in PyQt5, than I can understand that this issue doesn't concern > no-one and I have to look somewhere else to find a 3d-plotting lib which is > embedable. > > cheers, > Christain > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > > On Tuesday, April 21, 2015 1:44 PM, Benjamin Root <ben...@ou...> > wrote: > > > The addmpl() method isn't right. You created a canvas object, assigned it > to self.canvas, but then tried to call FigureCanvas.__init__(), passing it > whatever object "self" is. What class is addmpl() a part of? What does it > subclass? > > On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros <am...@ym...> > wrote: > > Hi, > > I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get > the following error: > > /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009: > UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled. Set > canvas then call Axes3D.mouse_init(). > warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation > disabled. Set canvas then call Axes3D.mouse_init().') > > From Stackoverflow, which host to question about this, I know that mouse > actions are disabled when the canvas is re-initialized by whatever. > > The only position I do such an operation is in here: > > > > > > > > *def addmpl(self, fig): self.canvas = FigureCanvas(fig) > #FigureCanvas.__init__(self, fig) #Axes3D.mouse_init(self) > self.mplvl.addWidget(self.canvas) self.canvas.draw() > self.toolbar = NavigationToolbar(self.canvas, self.mplwindow, > coordinates=True) self.mplvl.addWidget(self.toolbar)* > > On of the Stackoverflow suggestion says, that re initializing FigureCanvas > should do the trick but I'll get: > > Traceback (most recent call last): > File "./ex_0.1.py", line 145, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 116, in addmpl > FigureCanvas.__init__(self, fig) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py", > line 181, in __init__ > FigureCanvasQT.__init__(self, figure) > File > "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py", > line 237, in __init__ > super(FigureCanvasQT, self).__init__(figure=figure) > TypeError: super(type, obj): obj must be an instance or subtype of type > > as follow-up error message. > > just using *Axes3D.mouse_init()* , as suggested by matplotlib itself, > leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init() > TypeError: mouse_init() missing 1 required positional argument: 'self' > > adding self leads to: > > Traceback (most recent call last): > File "./ex_0.1.py", line 146, in <module> > main(sys.argv) > File "./ex_0.1.py", line 53, in main > mainwindow.addmpl(fig1) > File "./ex_0.1.py", line 118, in addmpl > Axes3D.mouse_init(self) > File > "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py", > line 1002, in mouse_init > canv = self.figure.canvas > AttributeError: 'Main' object has no attribute 'figure' > ./ex_0.1.py & > > Maybe I'm adding those lines at the wrong place, but I could fined > anything useful in the matplotlib documantation, that would help me out, > either. > > Any thougts that might help? > > Cheers, > Christian > > -- > "A little learning never caused anyone's head to explode!" > > > "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!" > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live > exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- > event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > |