You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow selection of the Matplotlib backend using the MPLBACKEND enviro… - #135
This patch allows setting the Matplotlib backend without changing the users' scripts or customizing default options (in .matplotlibrc). This feature is especially useful when mixing (existing) PyPlot calls with functions provided by the GR framework, a universal framework for cross-platform visualization applications.
A similar pull request (for Matplotlib) has already been accepted by the MPL developers. Here you can find a Python example which can easily be ported to Julia, providing enhanced features, especially for real-time visualization.
This is how a Julia example would look like:
import PyCall
@PyCall.pyimport numpy as np
import PyPlot
mpl = PyPlot
import GR
angles = np.load("700K_460.npy")
lens = []
for t in 1:100
mpl.cla()
fig = mpl.subplot(211)
mpl.ylim([0, 1000])
mpl.hist(angles[t], 20, normed=0, facecolor="g", alpha=0.5)
mpl.show()
lens = [lens, np.size(angles[t])]
if t > 1
GR.setwindow(0, 10, 3500, 5000)
GR.setviewport(0.1, 0.9, 0.05, 0.4)
GR.axes(1, 0, 0, 3500, 2, 0, 0.005)
GR.polyline(np.arange(t) / 10.0, lens)
end
GR.updatews()
end
I understand. I changed the logic in the last commit (0321c0d). The find_backend function is no longer called when the MPLBACKEND environment is set. The user should be able to switch the backend without changing a single line of code. Is this ok?
No, you still need find_backend. For one thing, the MPLBACKEND might not be supported. For another thing, find_backend figures out whether we need to start a GUI event-loop thread for the backend.
Basically, I think you should just alter/extend the default = lowercase(get(rcParams, "backend", "none")) line in find_backend
Question: if you have both MPLBACKEND and a backend specified in your matplotlibrc, which takes precedence?
Ah, I see the docs say: Setting this environment variable will override the``backend``parameter in *any*``matplotlibrc``, even if there is a``matplotlibrc``in your current working directory.
Checked out PyPlot.jl master branch - works perfect.
Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch allows setting the Matplotlib backend without changing the users' scripts or customizing default options (in .matplotlibrc). This feature is especially useful when mixing (existing) PyPlot calls with functions provided by the GR framework, a universal framework for cross-platform visualization applications.
A similar pull request (for Matplotlib) has already been accepted by the MPL developers. Here you can find a Python example which can easily be ported to Julia, providing enhanced features, especially for real-time visualization.
This is how a Julia example would look like: