Skip to content
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

Bad integration with Plots' boxplot #132

Open
bertulli opened this issue Jan 24, 2023 · 2 comments
Open

Bad integration with Plots' boxplot #132

bertulli opened this issue Jan 24, 2023 · 2 comments

Comments

@bertulli
Copy link

bertulli commented Jan 24, 2023

Hi all!
First, thanks for your work. I have a large DataFrame, which I have already combined, enriched, grouped eccetera. Right now, it presents like this:

julia> df_grouped = groupby(df_temp, :mnemonic)
GroupedDataFrame with 36 groups based on key: mnemonic
First Group (106 rows): mnemonic = "adc"
 Row │ Instruction    Base power (W)     mnemonic 
     │ Any            Quantity…          String   
─────┼────────────────────────────────────────────
   1 │ adc_r0_r2_0    0.082735±6.4e-5 W  adc
   2 │ adc_r0_r2_10   0.082995±6.5e-5 W  adc
   3 │ adc_r0_r2_100  0.083458±6.4e-5 W  adc
   4 │ adc_r0_r2_105  0.083524±6.4e-5 W  adc
   5 │ adc_r0_r2_110  0.083737±6.5e-5 W  adc
  ⋮  │       ⋮                ⋮             ⋮
 102 │ adc_r0_r0_75   0.086597±6.1e-5 W  adc
 103 │ adc_r0_r0_80    0.08513±6.0e-5 W  adc
 104 │ adc_r0_r0_85    0.08737±6.2e-5 W  adc
 105 │ adc_r0_r0_90   0.086447±6.2e-5 W  adc
 106 │ adc_r0_r0_95   0.086695±6.0e-5 W  adc
                                   96 rows omitted
⋮
Last Group (106 rows): mnemonic = "sbcs"
 Row │ Instruction     Base power (W)     mnemonic 
     │ Any             Quantity…          String   
─────┼─────────────────────────────────────────────
   1 │ sbcs_r0_r2_0    0.083804±6.3e-5 W  sbcs
   2 │ sbcs_r0_r2_10   0.084062±6.2e-5 W  sbcs
   3 │ sbcs_r0_r2_100  0.084497±6.5e-5 W  sbcs
   4 │ sbcs_r0_r2_105  0.084568±6.5e-5 W  sbcs
   5 │ sbcs_r0_r2_110  0.084778±6.4e-5 W  sbcs
  ⋮  │       ⋮                 ⋮             ⋮
 102 │ sbcs_r0_r0_75   0.088057±6.7e-5 W  sbcs
 103 │ sbcs_r0_r0_80   0.086408±6.4e-5 W  sbcs
 104 │ sbcs_r0_r0_85   0.088377±6.6e-5 W  sbcs
 105 │ sbcs_r0_r0_90   0.088026±6.7e-5 W  sbcs
 106 │ sbcs_r0_r0_95   0.088148±6.6e-5 W  sbcs
                                    96 rows omitted

Now I want to show each instruction (corresponding to a group) as a box plot:

p = boxplot(0)
for df_group in df_grouped
    boxplot!(df_group[:, measure_power_sym], label=df_group[1,:mnemonic])
end
gui(p)

However, this causes some mess:
mess
If I try to show only the first group (for debugging purpose), with a minor code modification

p = boxplot(0)
for df_group in df_grouped[1:1]
    boxplot!(df_group[:, measure_power_sym], label=df_group[1,:mnemonic])
end
gui(p)

I get
mess
Is this normal? How can I make a single boxplot?


Note that if I don't use Measurements.jl, but only use the mean, I get "expected" results:
mess
mess
Thanks!

@giordano
Copy link
Member

giordano commented Jan 24, 2023

Yeah, if you don't want Measurements automatic plotting, you should get the values of your data when you plot it, I don't think there are many other alternatives. I don't see Measurements in your snippets, BTW.

@bertulli
Copy link
Author

Indeed it works using Measurements.value. However I wonder: since using boxplot this is not the behavior one usually would want, would it make sense to override Plots.boxplot? (Correct me if I am wrong, but box plots are not meant to show error bars, do they?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants