GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.
http://gadflyjl.org/stable/
Other
1.9k stars 250 forks source link

Adjusting tick widths for plots other than Geom.point #837

Open kmanalo opened 8 years ago

kmanalo commented 8 years ago
  1. Providing a fixed set of ticks - Original example plot(x=rand(10), y=rand(10), Geom.point, Stat.yticks(ticks=[0.0, 0.1, 0.9, 1.0]))
  2. Providing a fixed set of ticks for bar - WORKS plot(x=rand(10), y=rand(10), Stat.yticks(ticks=[0.0, 0.1, 0.9, 1.0]), Theme(default_point_size=0mm), Geom.point, Geom.bar)
  3. Providing a fixed set of ticks for bar - how do I define xmax, xmain? plot(x=rand(10), y=rand(10), Stat.yticks(ticks=[0.0, 0.1, 0.9, 1.0]), Geom.bar) Outputs: The following aesthetics are required by BarGeometry but are not defined: xmax, xmin

Just wondering what the approach should normally be - my desire is to work with bar charts here.

tlnagy commented 8 years ago

This works

plot(x=rand(10), y=rand(10), Guide.yticks(ticks=[0.0, 0.1, 0.9, 1.0]), Geom.bar)

Guide only changes the labels, while Stat transforms the aesthetics. That said, this shouldn't break like this.

tlnagy commented 8 years ago

I'm going to label this as a bug. What do you all think @shashi @Mattriks?

Mattriks commented 8 years ago

Here is an example which better shows the issues here. What do you think will be plotted?

srand(999)
ytix = Stat.yticks(ticks =[0.0, 0.1, 0.9, 1.0])
layer1 = layer(Geom.point, Geom.smooth)
layer2 = layer(ytix, Geom.smooth, Theme(default_color=colorant"red"))

p = plot(x=1:10, y=rand(10), layer1, layer2)

There is a larger question here about what should a layer contain wrt geometries and statistics? Conventional thought would say that a layer should contain one geometry (e.g. points or lines etc) and one statistic (e.g. a smoothing function and the identity function are both statistics). Guess what Gadfly does when it finds statistics that are not associated with geometries!

Mattriks commented 8 years ago

I've added an example (#894) to show why the above behavour is useful.