New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boxplot using only y values #210
Comments
There are a couple issues here:
In thinking about this just now, I had the thought that the current method of hoping that a Vector{Any} is good enough to allow dispatch on "processed" data is flawed and ripe for subtle bugs... I should replace the internal logic with a wrapper type: immutable InputData{T}
data::T
end so that it's explicit that an input has been processed and wrapped, and dispatch will never get confused. I'll create a separate issue for this, and the arrays of symbols issue should be resolved as part of that change. |
The weird boxplot drawing issue is fixed. I think the solution for the x-axis will be to have some sort of DiscreteAxis type that can map strings, etc to an x/y coordinate. I want to be able to overlay a scatter or violin plot over a boxplot but still allow new series to extend the axis. This can share implementation with the 'setStringVector..." stuff. |
In the current master, boxplots are working fine with a categorical variable in x, but it can be used with group. |
It can't be used with group. |
Yeah I see the bug.. investigating |
Awesome :D I found a little bug with the whisker length. I will fix it soon. |
@tbreloff The group bug was solved for a call like that, where x and group are the same, but it still gives a strange output in the following example: ToothGrowth = dataset("datasets","ToothGrowth")
boxplot(ToothGrowth, :Dose, :Len, group=:Supp, notch=true) |
Solve a bug with whisker lengths (#210)
I disagree that this is strange. At least... it's what I expect/want. The If you want them in different subplots because you don't like the overlap, On Tuesday, June 7, 2016, Diego Javier Zea notifications@github.com wrote:
|
I can't for the life of me figure out what But these don't sound like very general ideas. What if the x data isn't nicely spaced? What if there are lots of groups? Just seems like its usefulness would be limited, but what do I know? I don't even know what "Supp" is! |
Sorry... I was saying that
would be more intuitive than
|
I imagine also |
Ha.. oh it's a field not a setting. I can't decide if that makes me look better or worse 😮 I'm not sure I fully understand what that would mean (in the general sense). This might only work well with dataframe column labels? Even then there's lots of weirdness? |
Ok. I understand... In my opinion, no one wants superimposed boxplots (since you compare them side to side). So, having |
I think you're not the only one, but... would you agree that this discussion only really makes sense if your inputs are DataFrames and the Symbols for the columns? Would it make more sense to have a "facet" recipe (similar to how I did marginal hists) which can handle all this stuff? Then it prepares everything for a "generic" boxplot (or whatever else) series recipe... offsetting x-values as needed, creating the layout, etc. So you would call |
Your x = rand(10)
y = rand(10)
z = [0,0,0,0,1,1,1,1,1,1]
w = [1,0,1,0,1,0,1,0,1,0]
facet(x, y, <bla bla>, layout = z ~ w) # Can something like this work? |
That may be a lot trickier to implement, as you'd get the Symbols z/w inside the recipe, with no way to access the variables z/w. I'm sure there's a way, it's just not as straightforward as the DataFrame case. |
I imagine that maybe we can use a Facet type, which store the variables z and w and make the needed checks in its construction. So, it can use dispatch: |
The way I envision it: @userplot Facet
@recipe function f(facet::Facet; facet_groups = nothing)
# inputs are the tuple: facet.args
# TODO: process args with facet_groups to build a layout and assign series to subplots
end
#usage:
facet(args...; facet_groups = ???) |
The facet(args...; x_group=varx, y_group=vary) |
@tbreloff Is there a better/elegant way to do this? using RDatasets
iris = dataset("datasets","iris")
using Plots
pyplot(size=(300,300))
iris[:dummy] = 1 # To plot the boxplot
boxplot(iris, :dummy, [:SepalLength :SepalWidth :PetalLength :PetalWidth], layout=grid(1,4), link=:y) I was expecting to do something like: |
Ugh... I need to recode DataFrames support. I hate how I'm doing it now. On Wed, Jun 29, 2016 at 3:08 PM, Diego Javier Zea notifications@github.com
|
@tbreloff other thing about my last example... The boxplot linecolor is equal to the fillcolor, so the median line isn't visible. |
At the moment, you could indicate only Y values for
boxplot
, but the default width looks strange.Also would be great to support a list of columns names when a wide dataframe is used. I found difficult to plot series of data (Y) since they use the same X value (
1
):Thanks!
The text was updated successfully, but these errors were encountered: