juliaplots / plots.jl Goto Github PK
View Code? Open in Web Editor NEWPowerful convenience for Julia visualizations and data analysis
Home Page: https://docs.juliaplots.org
License: Other
Powerful convenience for Julia visualizations and data analysis
Home Page: https://docs.juliaplots.org
License: Other
I want to be able to pass in data, then also pass in a "group-by" vector/matrix which splits the data into multiple series. This could be done in the createKWargsList
method for each input type, or possibly the split could happen earlier, in the plot!(plt::Plot, args...; kw...)
method, passing in filtered data for each group.
Hi Tom. Matlab has a spy()
function for viewing the sparsity pattern of a matrix. I like the way Gadfly implements spy()
, which is to make a heatmap from a matrix (JuliaLang/julia#2121). I didn't see a way to do this through the Plots.jl api.
Just thinking out loud... when there's better support for line segments (#19) then I'll have the basics necessary for visualizing graphs. I'd like to settle on the best representation of graphs (LightGraphs?), and add the necessary hooks to add them to arbitrary plots, similar to how I'm doing DataFrames currently. Defaults could include no ticks/grid, etc.
There are numerous benefits to hooking into the Plots pipeline early in graphs visualization... one of them is that we could extend any graphs code to 3D once that framework is in place, with no extra work.
Similar to this example, I'd like an easy way to add this to a plot. I think it should be attached to a series (and not its own series).. possibly with a ribbon
keyword arg. Some possible syntax:
# add a ribbon, centered around y, with width 0.5
plot(y; ribbon = 0.5)
# add a ribbon, centered around y, where the width varies randomly
plot(y; ribbon = rand(length(y)))
# tuple of vectors... explicit min/max coords
plot(y; ribbon = (y-0.2, y+0.8))
# vector of tuples... explicit min/max coords
plot(y; ribbon = [(z-0.5, z+rand()) for z in 1:length(y)])
Probably should support ribboncolor
, etc args as well.
PyPlot seems to display at several intermediate stages of plot creation from IJulia, and doesn't show the final plot. I suspect this is due to PyPlot.jl automatically inserting the object into a display queue on calls to PyPlot.
Things to try:
PyPlot.figure
?PyPlot.plot
, PyPlot.legend
, etc with direct calls to matplotlib?Any ideas on what the plot commands should look like should go here. See https://github.com/tbreloff/Qwt.jl for how I think it should look.
So I don't forget where I saw it: GiovineItalia/Gadfly.jl#392
Try to comb through Gadfly to see if it's implemented already, and if not, implement it.
I started playing with the ability to create custom markers from polygon coordinates. This is with the Gadfly backend. I created a new Gadfly.GeometryElement
which wraps the vertices of the Shape
that you pass in... @dcjones do you want me to make a PR to expose this functionality to Gadfly directly? Right now the definitions are in Plots only.
Is there anyway to just get a handle to a plot/figure and then be able to add plots to it with plot!
at a later stage.
I tried plot()
but it didn't work. Nice package by the way!
with this
julia> Pkg.status()
20 required packages:
- BinDeps 0.3.17
- Cairo 0.2.31 master
- Clang 0.0.5+ master
- Colors 0.5.4
- Dates 0.4.4
- Gadfly 0.3.16+ master
- GraphViz 0.0.4 master
- Graphs 0.5.6
- Gtk 0.9.2 master
- GtkUtilities 0.0.5
- HttpParser 0.1.1
- ImageView 0.1.17 master
- Images 0.4.48 master
- Immerse 0.0.7 master
- Plots 0.2.0+ master
- PyCall 1.1.2
- PyPlot 2.1.1
- Tk 0.3.6+ master
- Vega 0.4.1
- Winston 0.11.12+ master
i get
lobi@orange4:~/juliarepo$ ../julia04/julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-rc2 (2015-09-18 17:51 UTC)
_/ |\__'_|_|_|\__'_| |
|__/ | x86_64-linux-gnu
julia> using Plots
WARNING: New definition
push!(Plots.Plot, Any, AbstractArray{T<:Any, 1}) at /home/lobi/.julia/v0.4/Plots/src/utils.jl:174
is ambiguous with:
push!(Plots.Plot, Integer, Any) at /home/lobi/.julia/v0.4/Plots/src/utils.jl:154.
To fix, define
push!(Plots.Plot, Integer, AbstractArray{T<:Any, 1})
before the new definition.
[Plots.jl] Default backend: immerse
This should actually be really easy, but I'm very hesitant to add the dependencies. If anyone's following these issues, please weigh in on whether it's valuable enough to force the dependency. I could also make it optional by waiting to import DataFrames and define the relevant methods until the user calls a method explicitly. (dataframes!()
?)
In short, if a DataFrame is the first argument, then x
, y
, and group
could be Union(ArrayType,Symbol)
(recursively), the symbols are mapped to the DataFrame column, and labels are set (only if "AUTO").
Groundwork is laid, I just need the Compose contexts for other shapes.
See: https://groups.google.com/forum/?hl=en#!topic/julia-users/fveGH7w3kZE
@lobingera Partially from your comment in another thread, I'm going to remove some of the !
s from method names which aren't necessary for dispatch. plot!
is one method where I'll leave it as is, even when there are no arguments which are directly updated, since plot
and plot!
are useful to distinguish between creating a new plot object or adding to an existing one. immerse()
is fine, and I suppose there are some functions that can be squashed to one method:
plotter!(sym) --> plotter(sym)
currentPlot!(plt) --> currentPlot(plt)
title!(str) --> title(str) # and the other similar shorthands
dataframes!() --> dataframes()
I'll push those up fairly soon and I'll try to remember to tag a minor release update.
I'd be happy to implement the UnicodePlots part once I consider UnicodePlots.jl stable
When set to :auto
, it will cycle through all available options.
Support both discrete and continuous color schemes, probably through the color
/markercolor
/ribboncolor
keywords.
When you pass a vector of vectors or vector of tuples into color
, then the inner item will be treated as a color scheme. Color is determined by the z value if present, otherwise the y value?
See #4 (comment) and http://docs.ggplot2.org/current/scale_gradient2.html for examples of what to support.
I'd expect the first example to be generated something like:
using Plots, OnlineStats
y = cumsum(randn(100))
v = Variance()
sigma = Float64[(update!(v, yi); std(v)) for yi in y]
plot(y; c=:blue, ribbon = sigma, ribboncolor = (sigma, :blues))
Matplotlib and Winston has the text
command to directly insert text into a plot. I don't see this functionality in Plots.jl
. It would be nice to have.
Here are some other plot types that might be useful to add to this package. They come from SymPy's plotting module and are supported in PyPlot and others, though not fully:
contour
?)plot
?)surfaceplot
?)vectorplot
? quiver
?)plot_implicit for making plots of implicit functions
We should allow a symbol to be passed into the pyplot!()
method which defines the PyPlot backend (:qt, :tk, etc) and set that up properly.
I hope this isn't something I missed. Feature request for something similar to R's xlim
and ylim
plot arguments for specifying the endpoints for the axes.
Ticks:
Limits:
Tick labels:
Thank you for great plot lib for the Julia!.
Bytheway currently it seems that "savefig" exports graph only in png format.
Is it possible to add "SVG" and/or "eps" export option?
Gadfly PyPlot works great with SVG and EPS formats.
It would be great for Plots to support vector graphic formats.
I could add a call to dataframes()
and any other similar optional functionality, wrapped in the __init__
block and a try/catch block. Then I still don't need to require the package, but the user also doesn't have to call dataframes()
directly if they have the dependencies already installed.
This is the only way I can reproduce... might be unrelated to Plots:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-rc1+1 (2015-09-09 16:12 UTC)
_/ |\__'_|_|_|\__'_| | Commit 70ed392 (3 days old release-0.4)
|__/ | x86_64-apple-darwin13.4.0
julia> gadfly!()
ERROR: UndefVarError: gadfly! not defined
julia> using Plots
julia> gadfly!()
Plots.GadflyPackage()
julia> plot(rand(10,2); marker = :rect) # this will bring up a browser window with the plot, set show=false if you don't want that
[Plots.jl] Initializing package: gadfly
[Plots.jl] done.
julia> savepng(Plots.IMG_DIR * "gadfly1.png")
julia> qwt!() # switches the backend to Qwt... equivalent to `plotter!(:qwt)`
Plots.QwtPackage()
julia> plot(rand(10,2); marker = :rect) # this will bring up a browser window with the plot, set show=false if you don't want that
[Plots.jl] Initializing package: qwt
WARNING: could not import Base.help into PyCall
[Plots.jl] done.
2015-09-12 22:15:37.981 julia[74212:507] -[__NSCFType symbolicTraits]: unrecognized selector sent to instance 0x7f804614b360
2015-09-12 22:15:37.985 julia[74212:507] An uncaught exception was raised
2015-09-12 22:15:37.986 julia[74212:507] -[__NSCFType symbolicTraits]: unrecognized selector sent to instance 0x7f804614b360
2015-09-12 22:15:37.986 julia[74212:507] (
0 CoreFoundation 0x00007fff8ba8925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8e368e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ba8c12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8b9e7272 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff8b9e6df8 _CF_forwarding_prep_0 + 120
5 AppKit 0x00007fff8a15264f -[__NSFontTypefaceInfo _postscriptName] + 337
6 AppKit 0x00007fff8a1520b1 +[__NSFontTypefaceInfo typefaceInfoForPostscriptName:] + 817
7 AppKit 0x00007fff8a15172a __NSGetMetaFontInstance + 570
8 AppKit 0x00007fff8a15148e -[NSCell _convertToText:] + 165
9 AppKit 0x00007fff8a1512e9 -[NSButtonCell _convertToText:] + 94
10 AppKit 0x00007fff8a150f67 -[NSButtonCell initTextCell:] + 73
11 AppKit 0x00007fff8a150ef7 -[_NSThemeWidgetCell initTextCell:] + 40
12 AppKit 0x00007fff8a150ea4 -[NSButtonCell init] + 34
13 AppKit 0x00007fff8a150d16 -[NSControl initWithFrame:] + 111
14 AppKit 0x00007fff8a150c1c -[NSButton initWithFrame:] + 82
15 AppKit 0x00007fff8a1509a4 -[_NSThemeWidget initWithButtonID:] + 243
16 AppKit 0x00007fff8a150854 +[_NSThemeCloseWidget closeWidgetInView:withButtonID:action:] + 63
17 AppKit 0x00007fff8a15053e +[NSWindow standardWindowButton:forStyleMask:] + 1257
18 AppKit 0x00007fff8a150013 -[NSThemeFrame newCloseButton] + 81
19 AppKit 0x00007fff8a14f29c -[NSThemeFrame _updateButtons] + 395
20 AppKit 0x00007fff8a14de47 -[NSThemeFrame initWithFrame:styleMask:owner:] + 144
21 AppKit 0x00007fff8a14c305 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 631
22 AppKit 0x00007fff8a14b882 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1054
23 AppKit 0x00007fff8a14b458 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
24 QtGui 0x000000031b3587cd -[QCocoaWindow initWithContentRect:styleMask:backing:defer:] + 74
25 QtGui 0x000000031b3586bd -[NSWindow(QWidgetIntegration) qt_initWithQWidget:contentRect:styleMask:] + 81
26 QtGui 0x000000031b34913a _ZL20qt_mac_create_windowP7QWidgetjmRK5QRect + 799
27 QtGui 0x000000031b3484a4 _ZN14QWidgetPrivate16createWindow_sysEv + 136
28 QtGui 0x000000031b3483eb _Z17qt_mac_window_forPK7QWidget + 160
29 QtGui 0x000000031b34dbee _ZN14QWidgetPrivate12setModal_sysEv + 102
30 QtGui 0x000000031b3e09c0 _ZN7QWidget6createElbb + 478
31 QtGui 0x000000031b3ec671 _ZN7QWidget10setVisibleEb + 195
32 Qwt.so 0x000000031f9cdb7e _ZN10sipQwtPlot10setVisibleEb + 116
33 QtGui 0x000000031b3e4f6f _ZN7QWidget10showNormalEv + 137
34 QtGui.so 0x000000031adf733f _ZL23meth_QWidget_showNormalP7_objectS0_ + 99
35 Python 0x0000000319cc0f72 PyObject_Call + 101
36 ??? 0x0000000319e7b641 0x0 + 13319517761
37 ??? 0x0000000319e7ad3c 0x0 + 13319515452
38 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
39 ??? 0x0000000319e7a90b 0x0 + 13319514379
40 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
41 ??? 0x0000000319e95794 0x0 + 13319624596
42 ??? 0x0000000319e95613 0x0 + 13319624211
43 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
44 ??? 0x0000000319e95500 0x0 + 13319623936
45 ??? 0x0000000319e95414 0x0 + 13319623700
46 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
47 ??? 0x000000030dc8a810 0x0 + 13116155920
48 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
49 ??? 0x000000030dc679c3 0x0 + 13116012995
50 ??? 0x000000030dc67672 0x0 + 13116012146
51 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
52 ??? 0x000000030dc675c6 0x0 + 13116011974
53 ??? 0x000000030dc67482 0x0 + 13116011650
54 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
55 ??? 0x000000030dc58ee8 0x0 + 13115952872
56 sys.dylib 0x000000010aaf17cd julia_run_interface_17955 + 477
57 sys.dylib 0x000000010aaf1830 jlcall_run_interface_17955 + 16
58 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
59 sys.dylib 0x000000010aafa395 julia_run_frontend_18242 + 501
60 sys.dylib 0x000000010aaf9b3c julia_run_repl_18228 + 220
61 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
62 sys.dylib 0x000000010ab08db6 julia__start_18634 + 3366
63 sys.dylib 0x000000010ab08fb9 jlcall__start_18634 + 9
64 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
65 julia 0x000000010982e704 true_main + 276
66 julia 0x000000010982e5d6 main + 86
67 julia 0x000000010982dac4 start + 52
68 ??? 0x0000000000000001 0x0 + 1
)
2015-09-12 22:15:37.988 julia[74212:507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType symbolicTraits]: unrecognized selector sent to instance 0x7f804614b360'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8ba8925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8e368e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ba8c12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8b9e7272 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff8b9e6df8 _CF_forwarding_prep_0 + 120
5 AppKit 0x00007fff8a15264f -[__NSFontTypefaceInfo _postscriptName] + 337
6 AppKit 0x00007fff8a1520b1 +[__NSFontTypefaceInfo typefaceInfoForPostscriptName:] + 817
7 AppKit 0x00007fff8a15172a __NSGetMetaFontInstance + 570
8 AppKit 0x00007fff8a15148e -[NSCell _convertToText:] + 165
9 AppKit 0x00007fff8a1512e9 -[NSButtonCell _convertToText:] + 94
10 AppKit 0x00007fff8a150f67 -[NSButtonCell initTextCell:] + 73
11 AppKit 0x00007fff8a150ef7 -[_NSThemeWidgetCell initTextCell:] + 40
12 AppKit 0x00007fff8a150ea4 -[NSButtonCell init] + 34
13 AppKit 0x00007fff8a150d16 -[NSControl initWithFrame:] + 111
14 AppKit 0x00007fff8a150c1c -[NSButton initWithFrame:] + 82
15 AppKit 0x00007fff8a1509a4 -[_NSThemeWidget initWithButtonID:] + 243
16 AppKit 0x00007fff8a150854 +[_NSThemeCloseWidget closeWidgetInView:withButtonID:action:] + 63
17 AppKit 0x00007fff8a15053e +[NSWindow standardWindowButton:forStyleMask:] + 1257
18 AppKit 0x00007fff8a150013 -[NSThemeFrame newCloseButton] + 81
19 AppKit 0x00007fff8a14f29c -[NSThemeFrame _updateButtons] + 395
20 AppKit 0x00007fff8a14de47 -[NSThemeFrame initWithFrame:styleMask:owner:] + 144
21 AppKit 0x00007fff8a14c305 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 631
22 AppKit 0x00007fff8a14b882 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1054
23 AppKit 0x00007fff8a14b458 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
24 QtGui 0x000000031b3587cd -[QCocoaWindow initWithContentRect:styleMask:backing:defer:] + 74
25 QtGui 0x000000031b3586bd -[NSWindow(QWidgetIntegration) qt_initWithQWidget:contentRect:styleMask:] + 81
26 QtGui 0x000000031b34913a _ZL20qt_mac_create_windowP7QWidgetjmRK5QRect + 799
27 QtGui 0x000000031b3484a4 _ZN14QWidgetPrivate16createWindow_sysEv + 136
28 QtGui 0x000000031b3483eb _Z17qt_mac_window_forPK7QWidget + 160
29 QtGui 0x000000031b34dbee _ZN14QWidgetPrivate12setModal_sysEv + 102
30 QtGui 0x000000031b3e09c0 _ZN7QWidget6createElbb + 478
31 QtGui 0x000000031b3ec671 _ZN7QWidget10setVisibleEb + 195
32 Qwt.so 0x000000031f9cdb7e _ZN10sipQwtPlot10setVisibleEb + 116
33 QtGui 0x000000031b3e4f6f _ZN7QWidget10showNormalEv + 137
34 QtGui.so 0x000000031adf733f _ZL23meth_QWidget_showNormalP7_objectS0_ + 99
35 Python 0x0000000319cc0f72 PyObject_Call + 101
36 ??? 0x0000000319e7b641 0x0 + 13319517761
37 ??? 0x0000000319e7ad3c 0x0 + 13319515452
38 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
39 ??? 0x0000000319e7a90b 0x0 + 13319514379
40 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
41 ??? 0x0000000319e95794 0x0 + 13319624596
42 ??? 0x0000000319e95613 0x0 + 13319624211
43 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
44 ??? 0x0000000319e95500 0x0 + 13319623936
45 ??? 0x0000000319e95414 0x0 + 13319623700
46 libjulia.dylib 0x0000000109843736 jl_apply_generic + 422
47 ??? 0x000000030dc8a810 0x0 + 13116155920
48 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
49 ??? 0x000000030dc679c3 0x0 + 13116012995
50 ??? 0x000000030dc67672 0x0 + 13116012146
51 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
52 ??? 0x000000030dc675c6 0x0 + 13116011974
53 ??? 0x000000030dc67482 0x0 + 13116011650
54 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
55 ??? 0x000000030dc58ee8 0x0 + 13115952872
56 sys.dylib 0x000000010aaf17cd julia_run_interface_17955 + 477
57 sys.dylib 0x000000010aaf1830 jlcall_run_interface_17955 + 16
58 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
59 sys.dylib 0x000000010aafa395 julia_run_frontend_18242 + 501
60 sys.dylib 0x000000010aaf9b3c julia_run_repl_18228 + 220
61 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
62 sys.dylib 0x000000010ab08db6 julia__start_18634 + 3366
63 sys.dylib 0x000000010ab08fb9 jlcall__start_18634 + 9
64 libjulia.dylib 0x00000001098436c3 jl_apply_generic + 307
65 julia 0x000000010982e704 true_main + 276
66 julia 0x000000010982e5d6 main + 86
67 julia 0x000000010982dac4 start + 52
68 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
signal (6): Abort trap: 6
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Abort trap: 6
tom-mac-laptop:~ tom$
Leave a gap on Inf/NaN
I am using julia 0.4rc. I just downloaded Winston and Plots but it seems that Winston is not recognized.
julia> using Plots
INFO: Precompiling module Plots...
[Plots.jl] Default backend: winston
julia> plot(x->sin(x),0,1)
[Plots.jl] Initializing backend: winston
WARNING: requiring "Dates" did not define a corresponding module.
WARNING: module Winston should explicitly import * from Base
ERROR: Couldn't import Winston. Install it with: Pkg.add("Winston")
in plotter at /home/yves/.julia/v0.4/Plots/src/plotter.jl:103
in plot at /home/yves/.julia/v0.4/Plots/src/plot.jl:46
julia> Pkg.add("Winston") # actually it is installed.
INFO: Nothing to be done
julia> plot(x->sin(x),0,1)
[Plots.jl] Initializing backend: winston
ERROR: Couldn't import Winston. Install it with: Pkg.add("Winston")
in plotter at /home/yves/.julia/v0.4/Plots/src/plotter.jl:103
in plot at /home/yves/.julia/v0.4/Plots/src/plot.jl:46
I'm trying to figure out the features and backends that are most important to support. There's a long TODO list at the bottom of the readme... If you see any of those items that are important to you (or if there's anything I should add), please let me know.
I think the next backends I want to implement are (in order?):
In terms of features, I find these most important:
What would you like to see next??
I've read the ANN on the mailing list.
You wrote that you might want to implement Vega.jl next. Could you maybe consider doing PyPlot instead of Vega next?
Here is why I ask: My usual usecases for plotting are either for analysis (Gadfly), or simulation (UnicodePlot / PyPlot). Pyplot simply because it opens a dedicated window where I can have live plots etc, which are useful in machine learning to keep an eye on the learning curve.
So basically I would like to get the Ball rolling by incorporating this library into all my ML Efforts (which for the moment are SupervisedLearning.jl , KSVM.jl and soon FeatureSelection.jl) as the Base plotting library where I provide custom plotting functions. For example to plot the decision boundary, margin, and support vectors for fitted SVM models.
Right now I've got styles, colors, sizes, and opacity all defined separately, but it might be nice to have internal types Stroke
and Fill
which hold this info so that I can dispatch on them.
Need framework to do regression testing automatically for changes in image output. Likely I'll want to use the new test @timholy is adding here: JuliaImages/Images.jl#367
How should it be structured? I'm thinking maybe a test/ref_img
directory, with a subdirectory for each backend, and plots ordered according to the examples/test plots. Then the automated tests could write out the newly generated png files to a temporary directory, then compare to the images in test/ref_img
.
If images compare, great. If not... I think ideally we could bring up a gui of some sort, which can show how the images differ, and give a nice dialog to optionally save the newly generated image as the new "reference image".
Thoughts on this process? Should this be part of travis tests, or only something to be run locally by us?
In Qwt, I have an interface that looks like:
a = animation(plt, "/tmp/png")
for x in 0:0.1:5
push!(plt, 1, x, sin(x))
refresh(plt)
saveframe(a)
end
makegif(a)
It creates a directory to store pngs of the snapshots, then at the end calls out to the system to run ffmpeg to create an animated gif.
This can't be the best way to do it. Does anyone know of a better solution?? cc: @timholy
Use mod1(argOptions)
to cycle through the choices. Current behavior shouldn't change, but you could, for example, do:
plot(randn(1000, 10); linestyles=[:solid, :dash])
And it would alternate between the styles... 5 solid, 5 dash.
Could also take this opportunity to do away with the pluralized form (or at least map AbstractVector inputs to the pluralized form automatically).
Looking at Gadfly's list, should support: :none
, :log10
, :log2
, :log
, :asinh
, :sqrt
This should probably be implemented similarly to axes
or linestyles
... there should be a supportedScales
method, _allScales
, etc. Default to :none
(identity)
Can maybe depend on https://github.com/tlycken/Contour.jl
Check out R's HTML widgets: http://www.htmlwidgets.org/
Would be cool if plots could do similar. @one-more-minute had a JS call macro and I'm wondering if it can be used to wrap JS libraries with no or minimal JS?
Edit:
Or maybe this is the wrong package and it should go in @joshday 's JS charts library?
As suggested in JuliaPlots/UnicodePlots.jl#19 (comment):
This seems to me to be much in line with the philosophy of Plots.jl, i.e. generic methods that adapt to the backend, or in this case, the output format -- so that you might have something like
save(plot, format="png")
rather thansavepng()
,savetxt()
,savesvg()
, and so on.
Installing Plots gives me the following errors:
If I do a Pkg.add("Plots") I get "Unknown package Plots"
If I try with a Pkg.clone then the package Colors is missing
I'm using julia 0.3.10 / Juno, but I suppose that's OK right?
thanks for your beautiful library.
I didn't put this in a pull request, as it isn't complete, but here is a start for a Winston backend. Basic things work. A couple thoughts:
plot!
command. One benefit is that it would be easier to check if a backend supports a certain type of plot. The various types will only increase.Anyways, for what it is worth, feel free to use this as you see fit.
immutable WinstonPackage <: PlottingPackage end
winston!() = plotter!(:winston)
# create a blank Winston.Plot object
function plot(pkg::WinstonPackage; kw...)
@eval import DataFrames
d = Dict(kw)
plt = Winston.FramedPlot()
# add the title, axis labels, and theme
Winston.setattr(plt, "xlabel", d[:xlabel])
Winston.setattr(plt, "ylabel", d[:ylabel])
Winston.setattr(plt, "title", d[:title])
# add the legend?
Plot(plt, pkg, 0, d, Dict[])
end
## dictionaries for conversion of Plots.jl names to Winston ones.
const winston_linestyle = Dict(:solid=>"solid",
:dash=>"dash",
:dot=>"dotted",
:dashdot=>"dotdashed",
:dashdotdot=>"dotdashed")
const winston_marker = Dict(:none=>".",
:ellipse=>"circle",
:rect => "square",
:diamond=>"diamond",
:utriangle=>"triangle",
:dtriangle=>"down-triangle",
:cross => "cross",
:xcross => "cross",
:star1 => "asterisk",
:star2 => "filled circle",
:hexagon => "asterisk"
)
# plot one data series
function plot!(::WinstonPackage, plt::Plot; kw...)
d = Dict(kw)
e = Dict()
# axis # :left or :right
# color # can be a string ("red") or a symbol (:red) or a ColorsTypes.jl
e[:color] = d[:color]
# # Colorant (RGB(1,0,0)) or :auto (which lets the package pick)
# label # string or symbol, applies to that line, may go in a legend
# width # width of a line
e[:linewidth] = d[:width]
# linetype # :line, :step, :stepinverted, :sticks, :dots, :none, :heatmap, :hexbin, :hist, :bar
# linestyle # :solid, :dash, :dot, :dashdot, :dashdotdot
e[:kind] = winston_linestyle[d[:linestyle]]
# marker # :none, :ellipse, :rect, :diamond, :utriangle, :dtriangle,
# # :cross, :xcross, :star1, :star2, :hexagon
e[:symbolkind] = winston_marker[d[:marker]]
# markercolor # same choices as `color`, or :match will set the color to be the same as `color`
# markersize # size of the marker
e[:symbolsize] = d[:markersize] / 3
## implement these ...
# heatmap_c # color cutoffs for Qwt heatmaps
# fillto # fillto value for area plots
# yrightlabel # string or symbol, label on the right (y) axis
# size # (Int,Int), resize the enclosing window
# pos # (Int,Int), move the enclosing window to this position
# windowtitle # string or symbol, set the title of the enclosing windowtitle
# screen # Integer, move enclosing window to this screen number (for multiscreen desktops)
# show # true or false, show the plot (in case you don't want the window to pop up right away)
# axis
# color
# label
# add to the legend
# axis
if d[:axis] != :left
warn("Winston only supports one y axis")
end
## do different types based on `linetype`
## should this use dispatch?
## lintype :line, :step, :stepinverted, :sticks, :dots, :none, :heatmap, :hexbin, :hist, :bar
if d[:linetype] == :none
Winston.add(plt.o, Winston.Points(d[:x], d[:y];
[(k,v) for (k,v) in delete!(copy(e), :kind)]...))
if d[:reg]
## add regression line
xs = d[:x]
betahat_0, betahat_1 = [ones(length(xs)) xs] \ d[:y]
ys = betahat_0 + betahat_1 * xs
Winston.add(plt.o, Winston.Curve(xs, ys, kind="dotted"))
end
elseif d[:linetype] == :line
d[:marker] != :none && Winston.add(plt.o, Winston.Points(d[:x], d[:y];
[(k,v) for (k,v) in delete!(copy(e), :kind)]...))
Winston.add(plt.o, Winston.Curve(d[:x], d[:y]; [(k,v) for (k,v) in e]...))
elseif d[:linetype] == :step
fn = Winston.XXX
elseif d[:linetype] == :stepinverted
fn = Winston.XXX
elseif d[:linetype] == :sticks
Winston.add(plt.o, Winston.Stems(d[:x], d[:y]; [(k,v) for (k,v) in e]...))
elseif d[:linetype] == :dots
fn = Winston.XXX
elseif d[:linetype] == :heatmap
fn = Winston.XXX
elseif d[:linetype] == :hexbin
fn = Winston.XXX
elseif d[:linetype] == :hist
hst = hist(d[:y], d[:nbins])
Winston.add(plt.o, Winston.Histogram(hst...; [(k,v) for (k,v) in delete!(copy(e), :nbins)]...))
elseif d[:linetype] == :bar
fn = Winston.XXX
end
plt
end
function savepng(::WinstonPackage, plt::PlottingObject, fn::String, args...)
f = open(fn, "w")
writemime(f, "image/png", plt.o)
close(f)
end
function Base.display(::WinstonPackage, plt::Plot)
Winston.display(plt.o)
end
@tbreloff The plot
function documentation should be replicated as a stand-alone document, and probably put to JuliaPlot
documentation repo for general discussion of a future Julia plotting interface.
I'd like an easy way to support annotations, which will need to be mapped to a 3-tuple (x, y, annotation)
. So maybe:
# create a text annotation with the value of y under each point (3-tuple of vectors)
plot(x, y; annotations = (x, y, map(string,y)), annotationguide = :under)
# create a text annotation with the value of y automatically positioned for each point (vector of 3-tuples)
plot(x, y; annotations = [(x[i], y[i], string(y[i])) for i in 1:length(y)], annotationguide = :auto)
Annotations could be text, shapes, images, svg, or anything else that a backend might support.
It would be nice to provide:
It would be nice for a user to try to do something, and be well directed to a different backend if they want to do something that the backend doesn't support.
I want to be able to do something like the following, which will just override the defaults for the block, resetting the defaults at the end:
@with color=:green , width = 10 begin
plot(x, y)
scatter!(x2, y2)
...
end
Probably with either a hline!
or vline!
call, and/or a keyword arg in plot!
that does it inline.
I want to be able to delete!
from a plot by series index or label, and possibly the no-arg version will delete all series (could possibly use empty!
for that one).
I added the abstract type PlotRecipe
, which will hopefully give a straightforward framework to create complex plots, and also give package authors nice ways to visualize parts of their packages.
An example, which could be the basis of an overlay of PCA results, among other things:
and the recipe is defined like:
type EllipseRecipe <: PlotRecipe
w::Float64
h::Float64
x::Float64
y::Float64
θ::Float64
end
EllipseRecipe(w,h,x,y) = EllipseRecipe(w,h,x,y,0)
# return x,y coords of a rotated ellipse
function rotatedEllipse(w, h, x, y, θ, rotθ)
# # coord before rotation
xpre = w * cos(θ)
ypre = h * sin(θ)
# rotate and translate
r = rotate(xpre, ypre, rotθ)
x + r[1], y + r[2]
end
# implement this, and return whatever should be passed in as x/y for the plot command
function getRecipeXY(ep::EllipseRecipe)
x, y = unzip([rotatedEllipse(ep.w, ep.h, ep.x, ep.y, u, ep.θ) for u in linspace(0,2π,100)])
top = rotate(0, ep.h, ep.θ)
right = rotate(ep.w, 0, ep.θ)
linex = Float64[top[1], 0, right[1]] + ep.x
liney = Float64[top[2], 0, right[2]] + ep.y
Any[x, linex], Any[y, liney]
end
# implement this, and return a Dict or list of pairs that will be splatted as keyword args
function getRecipeArgs(ep::EllipseRecipe)
[(:line, (3, [:dot :solid], [:red :blue], :path))]
end
If anyone has ideas for cool recipes that should be included, please comment. I'm thinking that it might make sense to have a separate repo PlotRecipes.jl which compiles a library of them...
Need to make a small PR in Immerse to get access to the GtkBox
that is created, then just compose them together in GtkPaned
s
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.