GithubHelp home page GithubHelp logo

winston.jl's Introduction

Winston: 2D Plotting for Julia

CI Coverage Status

Installation

julia> Pkg.add("Winston")

Getting started

Winston offers an easy to use plot command to create figures without any fuss. After Winston is loaded by typing using Winston, the most basic plot can be created by just writing

julia> plot(x, y)

There is also an oplot command to add objects into already existing plots. To add something to this, use

julia> oplot(x2, y2)

And finally save it with

julia> savefig("figure.png")   # .eps, .pdf, & .svg are also supported

More elaborate figures can be created by using the quick option for color, line, and symbols

julia> plot(x, y, "r--")

This creates a red dashed curve. Abbreviations for colors and lines/symbols are same as in matplotlib. The plot command can also take more then one set of vectors and style options, like this

julia> plot(x, y, "b:", x2, y2, "g^")

which creates a blue dotted line and green triangles.

Documentation

Hosted by Read The Docs.

winston.jl's People

Contributors

ararslan avatar emaadmanzoor avatar femtocleaner[bot] avatar garborg avatar github-actions[bot] avatar heliosdrm avatar hustf avatar ihnorton avatar ivanslapnicar avatar jakebolewski avatar jeffbezanson avatar juliatagbot avatar jverzani avatar keno avatar kmsquire avatar kristofferc avatar magistere avatar mbauman avatar mvkma avatar my-little-repository avatar nalimilan avatar natj avatar nolta avatar pwl avatar stefankarpinski avatar timholy avatar tkelman avatar tknopp avatar vtjnash avatar westleyargentum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winston.jl's Issues

I can't load Winston

julia> Pkg.update()
Branch devel set up to track remote branch devel from origin.
Already up-to-date.

julia> using Winston
ERROR: could not open file /home/dzea/bin/julia-master/usr/share/julia/site/v0.2/Winston/src/Winston.ini
 in open at io.jl:275
 in read at /home/dzea/.julia/IniFile/src/IniFile.jl:66
 in anonymous at /home/dzea/.julia/Winston/src/Winston.jl:39
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /home/dzea/.julia/Winston/src/Winston.jl:31

julia> versioninfo()
Julia Version 0.2.0-1825.rbc12b884
Commit bc12b8844c 2013-06-05 01:35:25
Platform Info:
  OS_NAME: Linux
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT)
  LAPACK: libopenblas
  LIBM: libopenlibm

Winston broken?

I am on the latest master, and I also checked out the latest masters for Cairo, Tk, and Winston (I was getting errors going with the versions in METADATA). I get the following and no plot.

              _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.2.0-1616.r542307f5
 _/ |\__'_|_|_|\__'_|  |  Commit 542307f5bb 2013-05-20 23:47:20
|__/                   |

julia> plot(1:10)
warning: sub-optimal solution for plot
<plot>

Aspect ratio not honored

Entering the following at the repl produces a plot, but not one with the requested aspect ratio:

a = randn(100);
b = 10*randn(100);
p = FramedPlot()
setattr(p, "aspect_ratio", 1)
Winston._plot(p, a, b, ".")

Segfault on OSX 10.8: assertion `G_IS_OBJECT (object)' failed

Not sure if this is a Winston Issue or a Julia issue, but when running example1.jl from this repository, I get a signal 11:

(process:13482): GLib-GObject-CRITICAL **: gpointer g_object_ref(gpointer): assertion `G_IS_OBJECT (object)' failed

(process:13482): GLib-GObject-CRITICAL **: gpointer g_object_get_qdata(GObject *, GQuark): assertion `G_IS_OBJECT (object)' failed

(process:13482): GLib-GObject-CRITICAL **: void g_object_set_qdata_full(GObject *, GQuark, gpointer, GDestroyNotify): assertion `G_IS_OBJECT (object)' failed
Segmentation fault: 11

Running it in gdb, my backtrace is:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x000000010550a576 in pango_fontset_foreach ()
(gdb) bt
#0  0x000000010550a576 in pango_fontset_foreach ()
#1  0x0000000105508f38 in get_shaper_and_font ()
#2  0x0000000105508303 in itemize_state_process_run ()
#3  0x0000000105507cee in pango_itemize_with_base_dir ()
#4  0x000000010550c555 in pango_layout_check_lines ()
#5  0x000000010550eef0 in pango_layout_get_extents_internal ()
#6  0x000000010550f18e in pango_layout_get_pixel_extents ()
#7  0x000000010550f1fe in pango_layout_get_pixel_size ()
#8  0x0000000105d28a62 in ?? ()
#9  0x0000000105d28968 in ?? ()
#10 0x0000000100049ad5 in jl_apply_generic ()
#11 0x0000000105d274af in ?? ()
#12 0x0000000100049ad5 in jl_apply_generic ()
#13 0x0000000105d1956d in ?? ()
#14 0x0000000100049ad5 in jl_apply_generic ()
#15 0x0000000105d1035d in ?? ()
#16 0x0000000105d0f618 in ?? ()
#17 0x0000000105d0d448 in ?? ()
#18 0x0000000105d0cfaa in ?? ()
#19 0x0000000105d0cb7a in ?? ()
#20 0x0000000100049ad5 in jl_apply_generic ()
#21 0x0000000105d0c956 in ?? ()
#22 0x0000000100049ad5 in jl_apply_generic ()
#23 0x000000010007e7e4 in do_call ()
#24 0x000000010007d779 in eval ()
#25 0x00000001000889d4 in jl_toplevel_eval_flex ()
#26 0x0000000100088e45 in jl_parse_eval_all ()
#27 0x00000001000890d8 in jl_load_ ()
#28 0x0000000101d47fbd in ?? ()
#29 0x0000000101d48241 in ?? ()
#30 0x0000000101d47c1a in ?? ()
#31 0x0000000100049ad5 in jl_apply_generic ()
#32 0x0000000101d2effd in ?? ()
#33 0x0000000100049ad5 in jl_apply_generic ()
#34 0x0000000101d19296 in ?? ()
#35 0x0000000100049ad5 in jl_apply_generic ()
#36 0x00000001000018a1 in true_main ()
#37 0x0000000100082613 in julia_trampoline ()
#38 0x0000000100001c62 in main ()

This is on commit bc01356bb1, with pango 1.30.1 and cairo 1.12.2.

plothist to do hist + plot

Often, one wants to do hist() on the data and then plot the histogram. It would be nice to have a plothist function that does exactly this, and labels the ticks appropriately.

typo in Plot (patch attached)

diff --git a/src/Plot.jl b/src/Plot.jl
index ea2c90a..3f9a0b0 100644
--- a/src/Plot.jl
+++ b/src/Plot.jl
@@ -173,7 +173,7 @@ function data2rgb{T<:Real}(data::Array{T,2}, limits::Interval, colormap)
     for i = 1:numel(data)
         idx = iceil(ncolors*(data[i] - limits[1])/(limits[2] - limits[1]))
         if idx < 1 idx = 1 end
-        if idx > ncolors idx = ncol end
+        if idx > ncolors idx = ncolors end
         img[i] = colormap[idx]
     end
     img

Spy plot

I would love to have a matlab style spy plot for sparse matrices. Also, it would be nice to be able to do a density spy plot as well, which is essential for very large matrices.

plot inversion after resizing

The following steps invert a plot:

  1. Plot something
  2. Resize window
  3. Plot again

Resizing again fixes the plot, and the issue does not occur if you close the old resized window before creating a new plot. I can't tell if the problem is in Winston, Tk or Cairo - but this seemed to be the best place to file this issue.

This only happens on Mac, and I can't reproduce it on linux.

winston issue

Not sure whether I should file issues here or in the main julia project. I just filed issue #617 there.

Weird decision when choosing plot label increments

Try the following:

large = [i^4 for i in 1:10^3]
small = [1:10^3]

plot(small,large)

You'll notice that the y-axis is labeled as about 2,4,6 and 8x10^11 and 10^12. However, because they are not treated as exactly 2,4,6 and 8x10^11 the labels are really very long and distracting and should really just be rounded off.

This is much more noticeable when plotting plot(large,small) since then the x-axis becomes unreadable.

Avoid compilation prompt if libraries already available.

On linux, it is quite likely that the cairo package and dependencies are available. On mac, these dependencies are bundled in the downloadable application.

I suggest running the find_library() functions in ext.jl first in build.jl, and only presenting the compilation choices to the user if find_library() fails.

This would greatly reduce the barrier to getting graphics working in Julia.

New feature discussion: Interactive, animatable graphics

One of the key features that would make the Julia project a much more powerful data visualization and manipulation tool is the ability to have interactive graphics which would allow users to visualize their data and how they are transformed in real time.

Perhaps the most advanced such feature that is currently available is Mathematica's Manipulate[] function. Not only does it allow visualization of any type of valid Mathematica output (text, formula, graph, animation,...), it also automatically generates and places control widgets like 1-D and 2-D sliders. While the user is allowed to control the generation and placement of these widgets, having sane defaults for these allows the user to have something to play with rightaway without being distracted by having to futz around with the output to get something reasonable, if the user just wants to play with the data rather than have to design a GUI just to do so. With such features, the graphics are no longer passive receptacles for pretty pictures, but allow for powerful visualizations which are extremely helpful for learning numerical algorithms and deciphering published code listings. I personally find this very helpful for my work.

Furthermore, Mathematica graphical output objects are renderings that can be further manipulated, e.g. to create animations on the fly.

Mathematica documentation:

Ideally we would want something along these lines in Julia as well.

Some features to consider:

  • The ability to manipulate parametrically any kind of valid output type from Julia or Winston, possibly extensible to third-party output types.

  • Sane automatic generation and placement of a variety of controls

    • Tick boxes and radio buttons (for Boolean and small discrete inputs)
    • 1-D sliders (for Real input)
    • 2-D sliders (for Complex input)
    • Text boxes with optional type validation
    • Others?
  • Ability to further manipulate rendered graphics objects.

    • Graphical manipulations in the form of animations
    • Algebraic manipulation of plots. For example:
    x = [-pi:0.2:pi]
    y = sin(x)
    W = Curve(x, y)
    V = 2W - 1 #Same as Curve(x, 2y-1)
    p = FramedPlot()
    add(p, V)
    Winston.display(V)

    and have a plot of 2 sin(x) - 1.

symbol could not be found pango_cairo_create_layout

Winston was working great about a week ago. Now I'm getting the following:

julia> require("Winston")

julia> using Winston

julia> x = [-pi:0.2:pi];

julia> y = sin(x);

julia> p = FramedPlot()

julia> add(p, Curve(x, y));

julia> file(p, "winston.eps")
symbol could not be found pango_cairo_create_layout (-1): julia/jul/julia: undefined symbol: pango_cairo_create_layout
in CairoContext: ccall: null function pointer
 in CairoContext at /home/tshort/.julia/Cairo/src/Cairo.jl:197
 in CairoRenderer at /home/tshort/.julia/Cairo/src/Cairo.jl:463
 in EPSRenderer at /home/tshort/.julia/Cairo/src/Cairo.jl:509
 in write_eps at /home/tshort/.julia/Winston/src/Winston.jl:2476
 in file at /home/tshort/.julia/Winston/src/Winston.jl:2496

Julia Commit deb6ee8226 (2012-11-29 13:14:14)

`using Winston` gives strange stack overflow

I did a Pkg.add("Winston") on a clean setup, and built all the dependent libraries. Finally, this failed. Probably METADATA needs to be updated with a more recent Winston?

julia> 
viral-laptop 10:31:28 (master) ~/julia$ ./julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.2.0-1657.rb07b2aa9.dirty
 _/ |\__'_|_|_|\__'_|  |  Commit b07b2aa9a7 2013-05-22 11:28:07*
|__/                   |

julia> using Winston
ERROR: stack overflow
 in getrf! at linalg/lapack.jl:341
 in LU at linalg/factorization.jl:133
 in inv at linalg/dense.jl:396
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /Users/viral/.julia/Color/src/Color.jl:477
at /Users/viral/.julia/Cairo/src/Cairo.jl:4
at /Users/viral/.julia/Winston/src/Winston.jl:1

Null function pointer when plotting (with tk)

$ ./julia   
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.0.0+103653772.ra1b8
 _/ |\__'_|_|_|\__'_|  |  Commit a1b892d35c (2012-12-04 18:21:58)
|__/                   |

julia> require("Winston/src/Plot")

julia> using Plot

julia> plot(sin(1:30))
symbol could not be found jl_tkwin_display (-1): ./julia: undefined symbol: jl_tkwin_display
symbol could not be found jl_tkwin_id (-1): ./julia: undefined symbol: jl_tkwin_id
symbol could not be found jl_tkwin_visual (-1): ./julia: undefined symbol: jl_tkwin_visual
Error showing value of type FramedPlot:
in cairo_surface_for: ccall: null function pointer

An empty gray window opens every time I run plot(). I'm on Arch Linux x64.

Crash on render

Running the example in the README

julia> file(p, "winston.eps")
WARNING: push is deprecated, use push! instead.
WARNING: push is deprecated, use push! instead.
WARNING: push is deprecated, use push! instead.
WARNING: push is deprecated, use push! instead.
WARNING: enqueue is deprecated, use unshift! instead.

(process:34777): GLib-GObject-CRITICAL **: gpointer g_object_ref(gpointer): assertion `G_IS_OBJECT (object)' failed

(process:34777): GLib-GObject-CRITICAL **: gpointer g_object_get_qdata(GObject *, GQuark): assertion `G_IS_OBJECT (object)' failed

(process:34777): GLib-GObject-CRITICAL **: void g_object_set_qdata_full(GObject *, GQuark, gpointer, GDestroyNotify): assertion `G_IS_OBJECT (object)' failed

(process:34777): Pango-CRITICAL **: void pango_fontset_foreach(PangoFontset *, PangoFontsetForeachFunc, gpointer): assertion `PANGO_IS_FONTSET (fontset)' failed

(process:34777): Pango-CRITICAL **: void pango_fontset_foreach(PangoFontset *, PangoFontsetForeachFunc, gpointer): assertion `PANGO_IS_FONTSET (fontset)' failed

(process:34777): Pango-CRITICAL **: void pango_fontset_foreach(PangoFontset *, PangoFontsetForeachFunc, gpointer): assertion `PANGO_IS_FONTSET (fontset)' failed

(process:34777): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderCoreText', script='common'

(process:34777): GLib-GObject-CRITICAL **: gpointer g_object_ref(gpointer): assertion `G_IS_OBJECT (object)' failed

(process:34777): Pango-WARNING **: couldn't load font "sans-serif Not-Rotated 20.619140625px", modified variant/weight/stretch as fallback, expect ugly output.

(process:34777): GLib-GObject-CRITICAL **: gpointer g_object_ref(gpointer): assertion `G_IS_OBJECT (object)' failed

(process:34777): Pango-ERROR **: Could not load fallback font, bailing out.

the process then pauses, does not return to prompt. Pressing ^C then gets me back to my shell prompt.

MacOSX 10.7.5 brew installed cairo and pango

3d plots

Would it be possible to have 3d plots in Winston?

undocumented requirements

It seems that there are some additional dependencies on Ubuntu/Debian systems:

  • zlib
  • libpixman
  • tk-dev

I can't verify these, but there have been some reports from @HomerReid and his students.

The plots become upside down on the projector's screen

There is one issue I realized while introducing Julia to students in class. My Mac was connected to the projector, I plotted a graph and dragged the window with the graph to the projectors screen, as soon as I released the mouse button, everything within the window has become upside down (i.e. axes, curves, text). I am not sure what is the cause of it; probably the problem is in cairo.

Cannot install due to "BoundsError()"

Hello,

I recently installed Julia, but I cannot get Winston running:

julia> load("pkg.jl")

julia> Pkg.init()
Initialized empty Git repository in /home/daniel/.julia/.git/
[master (root-commit) a11656c] Initial empty commit
Cloning into 'METADATA'...
remote: Counting objects: 1109, done.
remote: Compressing objects: 100% (503/503), done.
remote: Total 1109 (delta 144), reused 1090 (delta 126)
Receiving objects: 100% (1109/1109), 92.55 KiB, done.
Resolving deltas: 100% (144/144), done.
[master ac3b5d9] Empty package repo
2 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 160000 METADATA
create mode 100644 REQUIRE

julia> Pkg.add("Winston")
BoundsError()
in resolve at /home/daniel/Extras/julia/usr/share/julia/base/pkgmetadata.jl:181
in _resolve at /home/daniel/Extras/julia/usr/share/julia/base/pkg.jl:193
in anonymous at no file:119
in cd at file.jl:19
in cd_pkgdir at /home/daniel/Extras/julia/usr/share/julia/base/pkg.jl:22
in add at /home/daniel/Extras/julia/usr/share/julia/base/pkg.jl:101
in add at /home/daniel/Extras/julia/usr/share/julia/base/pkg.jl:126

So it looks like there is a problem with the installer.

Minor plot formatting issues

I'm quite impressed at what can be done with Winston/Plot...

Couple of minor formatting issues

  1. In a log plot, 10^-5 prints as "9.99999999999999999 x 10^-6". For computation, this is fine, but for a plot display, it's a little distracting. :-)
  2. Latex mode is not working. Is there something I need to install/configure for this to work? I have latex installed on my computer. The x-axis label below was generated with
setattr(p[ts], "xlabel", L"Log $n$")

sort_times_int64

Documentation examples for on-screen plots

All the examples involve writing plots to files on disk. Drawing on-screen is simply calling Winston.display(p) for a plot p. It will be useful to have this documented in an example too.

Some arrays crash Julia and break X -- sometimes

Try the following:

large = [i^4 for i in 1:10^3]
small = [1:10^3]

plot(small,large)
plot(large,small)

julia> X Error of failed request: RenderBadPicture (invalid Picture parameter)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 8 (RenderComposite)
Picture id in failed request: 0x23 (some random hex number)
Serial number of failed request: 169 (some random number)
Current serial number in output stream: 169 (the same random number)

Unfortunately, as I have tried executing this sequence repeatedly to try and make sure the behavior is reproducible I have noticed that the Julia shell seems not to be crashing so much any more.

Won't load after fresh install - can't find Winston.ini

Here's the error message:

julia> using Winston
ERROR: could not open file /home/tshort/julia/jul/usr/share/julia/site/v0.2/Winston/src/Winston.ini
 in open at io.jl:275
 in read at /home/tshort/.julia/IniFile/src/IniFile.jl:66
 in anonymous at /home/tshort/.julia/Winston/src/Winston.jl:39
 in include_from_node1 at loading.jl:91
 in reload_path at loading.jl:114
 in require at loading.jl:48
at /home/tshort/.julia/Winston/src/Winston.jl:31

Julia was just updated. I started with a fresh ~/.julia. Here's my LOAD_PATH:

julia> LOAD_PATH
3-element Union(ASCIIString,UTF8String) Array:
 "/home/tshort/julia/jul/usr/share/julia/extras"         
 "/home/tshort/julia/jul/usr/local/share/julia/site/v0.2"
 "/home/tshort/julia/jul/usr/share/julia/site/v0.2"      

The code looks like it's searching the LOAD_PATH. There's nothing at those directories (they don't exist).

My system is Xubuntu 12.04.

Winston not working with mac binaries

Winston was installed fine. When I executed using Winston, I didn't get any warning or error message. But when I did the following:

x=randn(100)
plot(x)

I got the following message:

ERROR: in restore: splice! not defined
 in restore at /Users/mrxiaohe/.julia/Winston/src/renderer.jl:32
 in restore_state at /Users/mrxiaohe/.julia/Winston/src/renderer.jl:110
 in boundingbox at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:400
 in boundingbox at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:2906
 in exterior at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:1653
 in interior at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:2132
 in compose at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:2194
 in page_compose at /Users/mrxiaohe/.julia/Winston/src/Winston.jl:2212
 in anonymous at /Users/mrxiaohe/.julia/Winston/src/tk.jl:32
 in tk at /Users/mrxiaohe/.julia/Winston/src/tk.jl:36
 in compose_plot at /Users/mrxiaohe/.julia/Winston/src/Plot.jl:113
 in _plot at /Users/mrxiaohe/.julia/Winston/src/Plot.jl:101
 in plot at /Users/mrxiaohe/.julia/Winston/src/Plot.jl:23

I wonder what is the problem here. Thanks!!

[ViralBShah: Update title to reflect discussion]

ERROR: Stack OverFlow on file()

This is my code (can be reproduced):

using BioSeq
using Benchmark
using DataFrames
ft = Float64[]
gt = Float64[]
nn = Int[]
function percentGC_2(seq::Vector{Nucleotide})
         len = length(seq)
         sum = 0
         for elem in seq
           sum += (elem | 32 == 'c') | (elem | 32 =='g')
         end
         sum/len
       end
function compare_with_n()
  for n in 30:100:10030
    seq = [nucleotide('A');nucleotide('c');nucleotide('t');nucleotide('G')][rand(1:4,n)];
    f = ()-> percentGC(seq)
    g = ()-> percentGC_2(seq)
    @assert f() == g()
    cmp = compare([f,g],100);
    push!(ft,cmp[1,"Elapsed"])
    push!(gt,cmp[2,"Elapsed"])
    push!(nn,n)
  end
end
compare_with_n()
df = DataFrame(ft,gt,nn)
using Winston
p = FramedPlot()
setattr(p, "xrange", (min(df["x3"]),max(df["x3"])))
setattr(p, "yrange", (min([df["x1"],df["x2"]]),max([df["x1"],df["x2"]])))
setattr(p, "aspect_ratio", 1)

a = Points( df["x3"], df["x1"], "type", "circle" )
setattr(a, "label", "using if")

b = Points( df["x3"], df["x2"] )
setattr(b, "label", "branch predication")
style(b, "type", "filled circle" )

l = Legend( .1, .9, {a,b} )

add( p, a, b, l )
file(p, "bench.png")

This is the ERROR:

julia> file(p,"bench.png")
ERROR: stack overflow
 in BitArray at bitarray.jl:32
 in trues at bitarray.jl:147
 in reshape at abstractarray.jl:143
 in project at /home/dzea/.julia/Winston/src/Winston.jl:207 (repeats 34920 times)
 in project at /home/dzea/.julia/Winston/src/Winston.jl:247
 in make at /home/dzea/.julia/Winston/src/Winston.jl:2864
 in render at /home/dzea/.julia/Winston/src/Winston.jl:2933
 in render at /home/dzea/.julia/Winston/src/Winston.jl:1471
 in compose_interior at /home/dzea/.julia/Winston/src/Winston.jl:1698
 in compose at /home/dzea/.julia/Winston/src/Winston.jl:2225
 in page_compose at /home/dzea/.julia/Winston/src/Winston.jl:2238
 in write_png at /home/dzea/.julia/Winston/src/Winston.jl:2277
 in file at /home/dzea/.julia/Winston/src/Winston.jl:2286

using Winston failed

I use tried Winston (via JuliaStudio, mac os x, but that hardly the case), run sample (see below) and got the following output

Output

dir not defined
at /Users/ruslan/.julia/Cairo/src/Cairo.jl:1
at /Users/ruslan/.julia/Winston/src/Winston.jl:1
at /Users/ruslan/Source/temp/test.jl:2

Sample (test.jl)

using Winston

x = linspace( 0, 3pi, 100 )
c = cos(x)
s = sin(x)

p = FramedPlot()
setattr(p, "title", "title!")

setattr(p, "xlabel", L"\Sigma x^2_i")
setattr(p, "ylabel", L"\Theta_i")

add(p, FillBetween(x, c, x, s) )
add(p, Curve(x, c, "color", "red") )
add(p, Curve(x, s, "color", "blue") )

file(p, "example1.png")

symbolsize attribute doesn't work for Points objects (have proposed fix)

The difficulty is that _size_relative() doesn't know how to accept a string argument. This can be remedied by adding the following function definition to Winston.jl right after the existing definition of _size_relative().

function _size_relative(relsize::String, bbox::BoundingBox)
_size_relative(float(relsize), bbox)
end

maybe there is a more natural julian way to do this but the above works.

Canvas does not have redraw field

The current sha1 on METADATA.jl contains half of @JeffBezanson's transition from redraw->draw. I've edited my copy to work, but is it safe for me to update METADATA.jl to reflect the changes? Just want to be sure before I break anything.

(To be clear, the current commit that is grabbed by Pkg complains about a reference to redraw in src/tk.jl. Changing this to draw solves the problem, but isn't as elegant as @JeffBezanson's change.)

--Rob

Winston axis labels upside down

Winston.jl works fine recently. Today, I installed Julia in another Mac afresh, and run into the following problem.

On Mac OS X 10.8.4, latest Julia commit with every package on master (Cairo and Tk were built from source)

First, I see these warnings:

julia> using Winston
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.
WARNING: add_library_mapping is deprecated, use push!(DL_LOAD_PATH,"/path/to/search") instead.

Then, I did

x = [-pi:0.01:pi]
plot(x, sin(x))

The figure turns out to be as below
screen shot 2013-07-02 at 2 08 30 pm

Stack corruption warnings

I am seeing these warnings on the mac with the latest build, which are a bit scary:

    JULIA test/all
    From worker 4:       * numbers
    From worker 3:       * keywordargs
    From worker 5:       * strings
    From worker 2:       * core
    From worker 3:       * unicode
    From worker 3:       * collections
    From worker 2:       * hashing
    From worker 5:       * remote
    From worker 5:       * iostring
    From worker 5:       * arrayops
    From worker 2:       * linalg
    From worker 3:       * blas
    From worker 3:       * fft
    From worker 5:       * dsp
    From worker 3:       * sparse
    From worker 3:       * bitarray
    From worker 5:       * random
    From worker 5:       * math
    From worker 4:       * functional
    From worker 4:       * bigint
    From worker 4:       * sorting
    From worker 5:       * statistics
    From worker 5:       * spawn
    From worker 5:         [stdio passthrough ok]
    From worker 5:       * parallel
    From worker 4:       * priorityqueue
    From worker 4:       * arpack
    From worker 4:       * file
    From worker 3:       * perf
    From worker 4:       * suitesparse
    From worker 4:       * version
    From worker 4:       * resolve
    From worker 3:       * pollfd
    From worker 3:       * mpfr
    From worker 2:       * broadcast
    From worker 3:       * complex
    From worker 4:       * socket
    SUCCESS

warning: stack corruption detected
julia-release-basic(35458,0x101a81000) malloc: *** error for object 0xeb: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
warning: stack corruption detected
julia-release-basic(35460,0x101a81000) malloc: *** error for object 0xeb: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
warning: stack corruption detected
julia-release-basic(35459,0x101b81000) malloc: *** error for object 0xeb: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
warning: stack corruption detected
julia-release-basic(35457,0x101a81000) malloc: *** error for object 0xeb: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Pkg.add("Winston") fails on Tk dependency for OSX 10.8

I tried installing the Tk dependency with the source option (brew option had separate error messages)

julia> Pkg.runbuildscript("Tk")

... compiling messages ....

make: *** [tk3d.o] Error 1
make: *** [tkBitmap.o] Error 1
make: *** [tkBusy.o] Error 1
make: *** [tkClipboard.o] Error 1
make: *** [tkCmds.o] Error 1
make: *** [tkBind.o] Error 1
ERROR: failed process: Process(`make -j8`, ProcessExited(2)) [2]

ERROR: set_line_type not defined

I update sha1 on METADATA for last Winston master commit.
After update I get this error:

julia> using Winston
Warning: ignoring conflicting import of Graphics.fill into Winston
Warning: ignoring conflicting import of Graphics.clip_preserve into Winston
Warning: ignoring conflicting import of Graphics.arc into Winston
Warning: ignoring conflicting import of Graphics.polygon into Winston
Warning: ignoring conflicting import of Graphics.fill_preserve into Winston
Warning: ignoring conflicting import of Graphics.close_path into Winston
Warning: ignoring conflicting import of Graphics.rotate into Winston
Warning: ignoring conflicting import of Graphics.save into Winston
Warning: ignoring conflicting import of Graphics.paint into Winston
Warning: ignoring conflicting import of Graphics.new_sub_path into Winston
Warning: ignoring conflicting import of Graphics.restore into Winston
Warning: ignoring conflicting import of Graphics.set_line_width into Winston
Warning: ignoring conflicting import of Graphics.set_dash into Winston
Warning: ignoring conflicting import of Graphics.clip into Winston
Warning: ignoring conflicting import of Graphics.rel_line_to into Winston
Warning: ignoring conflicting import of Graphics.move_to into Winston
Warning: ignoring conflicting import of Graphics.set_source_rgb into Winston
Warning: ignoring conflicting import of Graphics.stroke_preserve into Winston
Warning: ignoring conflicting import of Graphics.new_path into Winston
Warning: ignoring conflicting import of Graphics.rectangle into Winston
Warning: ignoring conflicting import of Graphics.stroke into Winston
Warning: ignoring conflicting import of Graphics.line_to into Winston
Warning: ignoring conflicting import of Graphics.set_source_rgba into Winston
Warning: ignoring conflicting import of Graphics.circle into Winston
Warning: ignoring conflicting import of Graphics.rel_move_to into Winston
Warning: imported binding for RendererState overwritten in module Winston
Warning: imported binding for Renderer overwritten in module Winston
Warning: imported binding for CairoRenderer overwritten in module Winston
Warning: Method definition color_to_rgb(Integer,) in module Cairo at /home/dzea/.julia/Cairo/src/Cairo.jl:488 overwritten in module Winston at /home/dzea/.julia/Winston/src/renderer.jl:62.
Warning: Method definition color_to_rgb(String,) in module Cairo at /home/dzea/.julia/Cairo/src/Cairo.jl:489 overwritten in module Winston at /home/dzea/.julia/Winston/src/renderer.jl:63.
ERROR: set_line_type not defined
 in include_from_node1 at loading.jl:88 (repeats 2 times)
 in reload_path at loading.jl:111
 in require at loading.jl:46
at /home/dzea/.julia/Winston/src/renderer.jl:81
at /home/dzea/.julia/Winston/src/Winston.jl:26

User-friendly axis limits?

Some API bikeshedding here.

Currently it's not a smooth operation to discover the x- and y-limits on a plot. As a demonstration, run example 1, then:

julia> getattr(p, "xrange")

julia> p.x.range
ERROR: type _Alias has no field range

julia> p.x1.range
ERROR: type HalfAxisX has no field range

julia> getattr(p.x, "range")
ERROR: no method getattr(_Alias,ASCIIString)

julia> getattr(p.x1, "range")

julia> limits(p)
ERROR: limits not defined

julia> Winston.limits(p)
ERROR: no method limits(FramedPlot,)

julia> Winston.limits(p.content1)
BoundingBox(0.0,9.42477796076938,-1.0,1.0)

IIUC, the "xrange" attribute is really meant as a "manual override"; the fact that getattr(p, "xrange") returns nothing is a consequence of the fact that it hasn't been set. Some of the failures above could be avoided by making changes to the documentation, of course, but even that last line is not as simple as it should be.

I suspect the least-breaking solution to this problem would be to export a limits(p) function, and I am happy to write it. But I thought I'd first start a discussion because similar issues this may come up in other contexts.

Plot screwed up when being resized

I am using Julia 0.2 + Winston on Mac OS X (10.8)

using Winston

x = [-pi:0.01:pi]
plot(x, sin(x))

This produces
winston_screenshot_01

This is fine. But When I resize the figure (by dragging the boundary), the entire plot is screwed up, as below

winston_screenshot_02

The things are upside down and fragments scattered everywhere.

Warnings

julia> using Winston
WARNING: has(d,k) is deprecated, use haskey(d,k) instead.
in read at /Users/viral/.julia/IniFile/src/IniFile.jl:42

julia> plot(1:10)
WARNING: ends_with is deprecated, use endswith instead.
in _format_ticklabel at /Users/viral/.julia/Winston/src/Winston.jl:952
WARNING: unsafe_ref is deprecated, use unsafe_load instead.
in jl_tcl_callback at /Users/viral/.julia/Tk/src/tkwidget.jl:141

using Winston fails on the first try

When I run using Winston I get the following (I've included the Julia header for the version number):

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.0.0+109414273.r440b
 _/ |\__'_|_|_|\__'_|  |  Commit 440bbc5133 (2013-02-09 05:30:19)
|__/                   |

julia> using Winston
WARNING: strchr is deprecated, use search instead.
ERROR: in init: globalEventLoop not defined
 in init at /home/george/.julia/Tk/src/Tk.jl:55
 in include_from_node1 at loading.jl:76
 in reload_path at loading.jl:96
 in require at loading.jl:48
 in include_from_node1 at loading.jl:76
 in include_from_node1 at loading.jl:76
 in reload_path at loading.jl:96
 in require at loading.jl:48
at /home/george/.julia/Tk/src/Tk.jl:321

When I run it the second time it works like a charm and I can run the demo plots.

Segmentation fault: 11

I've just installed fresh Winston and ran the first example. Cairo was installed by brew and Tk from source. (Mac OS X 10.7.5, julia 0.2.0)

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.2.0
 _/ |\__'_|_|_|\__'_|  |  b3c30f3-Darwin-x86_64 (2013-05-21 13:48:50)
|__/                   |

julia> using Winston
Warning: could not import Graphics.set_source into Color

julia> 

julia> x = linspace( 0, 3pi, 100 )
100-element Float64 Array:
 0.0      
 0.0951998
 0.1904   
 0.285599 
 0.380799 
 0.475999 
 0.571199 
 0.666398 
 0.761598 
 0.856798 

 8.66318  
 8.75838  
 8.85358  
 8.94878  
 9.04398  
 9.13918  
 9.23438  
 9.32958  
 9.42478  

julia> c = cos(x)
100-element Float64 Array:
  1.0     
  0.995472
  0.981929
  0.959493
  0.928368
  0.888835
  0.841254
  0.786053
  0.723734
  0.654861

 -0.723734
 -0.786053
 -0.841254
 -0.888835
 -0.928368
 -0.959493
 -0.981929
 -0.995472
 -1.0     

julia> s = sin(x)
100-element Float64 Array:
 0.0        
 0.095056   
 0.189251   
 0.281733   
 0.371662   
 0.458227   
 0.540641   
 0.618159   
 0.690079   
 0.75575    

 0.690079   
 0.618159   
 0.540641   
 0.458227   
 0.371662   
 0.281733   
 0.189251   
 0.095056   
 3.67394e-16

julia> 

julia> p = FramedPlot()
<plot>

julia> setattr(p, "title", "title!")
"title!"

julia> 

julia> setattr(p, "xlabel", "\\Sigma x^2_i")
"\\Sigma x^2_i"

julia> setattr(p, "ylabel", "\\Theta_i")
"\\Theta_i"

julia> 

julia> add(p, FillBetween(x, c, x, s) )

julia> add(p, Curve(x, c, "color", "red") )

julia> add(p, Curve(x, s, "color", "blue") )

julia> 

julia> file(p, "example1.png")
Segmentation fault: 11

Besides program crash there is this weird warning on import.

plot() doesn't show a window

I might have these incantations wrong, but when I do the following:

julia> require("Winston/src/Plot")

julia> using Plot

julia> plot([1,2,3])

I don't get a popup window with a nice little graph. I instead get returned a FramedPlot, which spits out an incredibly long description of the plot. String representations notwithstanding, is there an error I'm missing somewhere?

OSX 10.8.2, Julia commit 0cb98db332

$ brew list --versions | grep "cairo\|pango"
cairo 1.12.6
pango 1.32.3

no method ShowError(FramedPlot,ASCIIString)

With a clean install of Winston, I'm getting the error in the title:

julia> p = FramedPlot()
no method ShowError(FramedPlot,ASCIIString)

p is actually usable, but something related to show() seems to be missing.

Examples 2,3,4,5 dot run on Mac OSX 10.8

I have tried all the examples and the examples 2,3,4,5 give me errors.
Examples 1 and 6 run and produce PNG plots. I'm I missing something. I have "export LD_LIBRARY_PATH=/usr/local/lib:/opt/X11/lib:$LD_LIBRARY_PATH"

load("example2")
Warning: replacing module Winston
empty container
in compose at /Users/jim/.julia/Winston/src/Winston.jl:2453
in page_compose at /Users/jim/.julia/Winston/src/Winston.jl:2476
in write_png at /Users/jim/.julia/Winston/src/Winston.jl:2515
in file at /Users/jim/.julia/Winston/src/Winston.jl:2524
in load_now at util.jl:235
in load_now at util.jl:247
at /Users/jim/Winston.jl/examples/example2.jl:31

load("example3")
Warning: replacing module Winston
no method assign(Table,FramedPlot,Int64,Int64)
in load_now at util.jl:235
in load_now at util.jl:247
at /Users/jim/Winston.jl/examples/example3.jl:18

load("example4")
Warning: replacing module Winston
no method convert(Type{PlotContainer},FramedPlot)
in PlotInset at /Users/jim/.julia/Winston/src/Winston.jl:1115
in load_now at util.jl:235
in load_now at util.jl:247
at /Users/jim/Winston.jl/examples/example4.jl:23

load("example5")
Warning: replacing module Winston
no method setattr(FramedArray,ASCIIString,Float64)
in load_now at util.jl:235
in load_now at util.jl:247
at /Users/jim/Winston.jl/examples/example5.jl:10

Loading Plot.jl

I have installed all the dependencies for Winston on my OS X 10.7.5. Plot.jl does not quite load:

julia> require("Plot")
could not open file /Users/viral/julia/Plot.jl
 in include_from_node1 at util.jl:244
 in reload_path at util.jl:252
 in require at util.jl:223

With the full path, I get this.

julia> require("/Users/viral/.julia/Winston/src/Plot.jl")
error compiling init: could not load module libX11: dlopen(libX11.dylib, 1): image not found
 in include_from_node1 at util.jl:244
 in reload_path at util.jl:252
 in require at util.jl:223
 in include_from_node1 at util.jl:244
 in reload_path at util.jl:252
 in require at util.jl:223
at /Users/viral/.julia/Tk/src/Tk.jl:260

Interactive plotting

On Debian Wheezy, Julia Version 0.2.0-801.r023d Commit 023d4604ae 2013-03-30 13:27:54
if I try the examples that save plots to a file Winston works fine, however interactive plotting does not seem to work very well. The x11() command mentioned somewhere in the docs is not defined. If I call plot(x, y) it works, I get a windows showing the plot, but when I try to add other elements to the plot (e.g. a curve) nothing happens. Is interactive plotting not fully supported yet?

Warnings in Plot and usability

We have deprecated strlen. It would be nice to get rid of the warnings when you do Plot.plot(1:10).

We are planning to use Winston in the tutorial tomorrow, and just going through usability stuff. Often when the windows overlap, it tends not to redraw.

Some of these may be Tk issues, but I am just filing them here.

-viral

Cannot center Histogram()

There is a x0 internal variable in Histogram() which appears to control the leftmost x-coordinate of the histogram plot, but it cannot be accessed at the user level using the current Histogram() call.

What is the status of exposing this variable in the Histogram() API?

This is directly related to fixme in Winston.jl:2250

Missing dependency on Iterators.jl

On a clean setup, I downloaded julia.app (v1.2), and tried installing Winston. I found that something in Winston's dependencies was missing a dependency on Iterators.

I manually installed Iterators, but then ran into ERROR: ParseError("Incomplete Expression") in Tk.

It would be nice to tag versions of Winston, Cairo, Tk, and BinDeps for v0.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.