Is it possible to plot pandas objects inside the PTVS interactive debugger? Is it possible to save plots to disk as jpeg's?
I think I was able to do this when I first started using PTVS (last year, its awesome by the way!) but I just tried again and I dont get any plots appearing. I cant remember if I had to do something special to get this to work and from doing some google searches I get a confusing picture of the current best practice in this regard.
I want to be able to plot diagrams from my debug interactive window, similar to what is shown on this pandas tutorial.
http://pandas.pydata.org/pandas-docs/stable/visualization.html
Is this possible?
Visual Studio Professional 2013 update 4 (latest I think)
PTVS 2.1.21008.00 (latest I think)
All help is greatly appreciated.
-Jason
[edit: more info on this http://pytools.codeplex.com/discussions/574776 ]
Unfortunately not. The regular interactive has an IPython mode that, among other things, enables inline plots. But the Debug interactive doesn't have that.
You can, of course, still load matplotlib in the Debug interactive and tell it to plot things. But because there's no integration of event loops between it and VS in that mode, the plots will basically work like modal windows - you won't be able to continue debugging or otherwise interact with VS until you close the plot window.
Related
I am plotting multiples signals overlapping in one figure using matplotlib and then saving it in pdf/eps using matplotlib.pyplot.savefig, the problem is that when I try to insert the figure in a pdf-latex file, it takes like 1.5 min to load because it starts rendering every plot. Is there any way to properly save or create these plots in one figure?
The final pdf works perfectly when I use preview on macOS, regularly when I use edge or chrome navigators and it is a disaster if I use adobe-reader. I am looking for a multiplatform solution.
I'm using a IPython console (IPython 8.3.0) for running scripts and then use the interactive console to manually inspect variables, try something new, etc.
My problem is with plotting figures - I'm looking for a way to display figures when using e.g. %matplotlib auto and %run myscript.py in the IPython console. I expect the figures drawn in separate windows, not inline.
I'm able to get the behavior I want by using %load myscript.py and executing the code, but this is quickly cluttering the history in the console.
I want to avoid using matplotlib.pyplot.show() in my scripts - if possible.
I there a way to achieve what I want without using %load or show()?
I am unable to produce any charts in Python (matplotlib 3.5.1) with the pandas DataFrame plot() method. A window opens and the axes return value is <AxesSubplot:> as opposed to returning an object like that prints as somethig like <matplotlib.axes._subplots.AxesSubplot at 0x7f3958bcf9d0>, which is what I usually see when the plot works.
The backend is QtAgg and as far as I can tell from a poke between fora pages that report a similar problem this should be all right. This is also not a problem with needing to run matplotlib.pyplot.ion() as I see a window open, but it is black with no plot in it.
Any advice would be useful, thanks!
I have resolved the (mis)behaviour without really being sure that I have resolved the issue responsible for this misbehaviour.
As looked around for a way out, I found this discussion (How to change backends in matplotlib / Python) which made a lot of getting the back end setting right. Wondering if that would make a difference, I changed the back end. The QtAgg back end loaded by default from the matplotlibrc file and so following the instructions in the post on how to permanently change the back end, I modified the file so that the back end is now Qt5Agg. The data now plots.
I'm using Atom/Juno as IDE for my Julia programming.
I use PyPlot for graphical representation of plots however I noticed two important aspects (I'm migrating from MATLAB)
1- figures do not appear automatically after running julia scripts but only after typing PyPlot.display_figs() in the REPL.
2- figures displayed in Atom are not interactive.
On the contrary, if I open Julia REPL from terminal and I run the same code an interactive window appears (only after typing PyPlot.display_figs()).
Can I use Atom and have interactive plots to appear automatically at the end of each script without everytime using the REPL?
You have two options:
Disable in built Atom plot Pane
Use interactive plotting backend (plotlyjs could be the best option)
Ad.1.
Go in Atom to Seetings->Packages->Julia Client->UI Options and disable the "Enable plot pane" option. Restart Atom.
Ad.2.
With the "Enable plot pane" turned on try running this code:
using Plots
plotlyjs()
Plots.plot(sin.(0:0.1:7))
Everything looks OK if I just run the scripts in Pycharm. It will show the plots.
However, after I convert the scripts into exe file. It can save the plots, but it won't show any plot. The most weird thing is that it will re-open another exe file.
Thanks, really appreciate if someone know the root cause.
As mentioned in the comment, calling matplotlib.use('WXAgg') is necessary, but there is another step: matplotlib has a backend object you need to import manually to paint a figure in wx: matplotlib.backends.backend_wxagg. This creates a figure canvas object inside a wx.panel of your choosing.
This answer contains a nice example. Furthermore, you can look up the actual object in matplotlib website, then proceed to look at their artist tutorial, which covers how to use matplotlib in applications rather well.