# \#statsplots

**URL:** https://discourse.julialang.org/tag/statsplots/402.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Show significance on boxplots](https://discourse.julialang.org/t/show-significance-on-boxplots/77365)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 18\
**Last updated:** [January 31, 2026, 10:32am UTC](https://discourse.julialang.org/t/show-significance-on-boxplots/77365 "2026-01-31T10:32:34Z")

</div>

I want to annotate the statistical significance of the difference between a pair of boxplots on my figure, as one of 'n.s.', '\*', '\*\*', '\*\*\*'. An example image of what I want is below, the best analogue I can find of wha…

---

## [How can I know the position for each label in the plot](https://discourse.julialang.org/t/how-can-i-know-the-position-for-each-label-in-the-plot/133884)

<div class="topic-metadata">

**Author:** [@Lucca\_Da\_Paz](https://discourse.julialang.org/u/Lucca_Da_Paz)\
**Replies:** 1\
**Last updated:** [November 15, 2025, 7:25am UTC](https://discourse.julialang.org/t/how-can-i-know-the-position-for-each-label-in-the-plot/133884 "2025-11-15T07:25:11Z")

</div>

How can I know the position in the x-axis for each label in my violin(x, y, group = x, linewidth=1, dpi = 300) boxplot!(x, y, fillalpha=0.4, fillcolor = colorant"gray", linecolor=:black, linewidth=1, legend=false, dpi = …

---

## [Bug in StatsPlots' call to groupedhist with normalize=:true?](https://discourse.julialang.org/t/bug-in-statsplots-call-to-groupedhist-with-normalize-true/133023)

<div class="topic-metadata">

**Author:** [@mocalvao](https://discourse.julialang.org/u/mocalvao)\
**Replies:** 5\
**Last updated:** [October 10, 2025, 11:36am UTC](https://discourse.julialang.org/t/bug-in-statsplots-call-to-groupedhist-with-normalize-true/133023 "2025-10-10T11:36:54Z")

</div>

Hi there, Consider the following data.csv file: Class\_Name Grade Turma 6 4.2 Turma 4 3.5 Turma 6 0.2 Turma 3 Especial 1.6 Turma 2 Piloto 7.8 Turma 4 1.4 Turma 5 1.6 Turma 6 3.8000000000000003 Turma 6 1.5 Turma 6 5.8000…

---

## [Broken permutation of axis in StatsPlots.jl with error bars](https://discourse.julialang.org/t/broken-permutation-of-axis-in-statsplots-jl-with-error-bars/131826)

<div class="topic-metadata">

**Author:** [@LucasV](https://discourse.julialang.org/u/LucasV)\
**Replies:** 4\
**Last updated:** [August 25, 2025, 1:37pm UTC](https://discourse.julialang.org/t/broken-permutation-of-axis-in-statsplots-jl-with-error-bars/131826 "2025-08-25T13:37:58Z")

</div>

Hi everyone, recently I’ve tried to plot a grouped bar using StatsPlots.jl with error bars. The plot works fine with no errors but when I insert them it does not work porperly, as shown in the example: Code: #Permutati…

---

## [How to set line color in errorline](https://discourse.julialang.org/t/how-to-set-line-color-in-errorline/129522)

<div class="topic-metadata">

**Author:** [@PanT12](https://discourse.julialang.org/u/PanT12)\
**Replies:** 2\
**Last updated:** [June 2, 2025, 3:02pm UTC](https://discourse.julialang.org/t/how-to-set-line-color-in-errorline/129522 "2025-06-02T15:02:13Z")

</div>

Hi everyone, I’m trying to set the line color in the errorline function from the StatsPlots package. However, I’ve noticed that I can only change the marker color and not the line color. Does anyone know how to set the …

---

## [Grouped Bar Plots](https://discourse.julialang.org/t/grouped-bar-plots/129170)

<div class="topic-metadata">

**Author:** [@chelseas](https://discourse.julialang.org/u/chelseas)\
**Replies:** 2\
**Last updated:** [May 21, 2025, 9:47am UTC](https://discourse.julialang.org/t/grouped-bar-plots/129170 "2025-05-21T09:47:39Z")

</div>

How do I get my grouped bar plot bars to be next to each other and not on top of each other? code pulling data from dataframe: plot\_vio = bar( categorical(analysis.type), analysis.val, group = categorical(string.…

---

## [Violin plot](https://discourse.julialang.org/t/violin-plot/128381)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 8\
**Last updated:** [April 25, 2025, 11:27am UTC](https://discourse.julialang.org/t/violin-plot/128381 "2025-04-25T11:27:17Z")

</div>

Hi there, It seems like violin plots truncate the support of the data. My understanding is that violin plots are kernel density estimates of the data but I’m struggling to find more information about the actual details. …

---

## [How to Collapse Dendrogram Branches to n Number of Leaves](https://discourse.julialang.org/t/how-to-collapse-dendrogram-branches-to-n-number-of-leaves/126323)

<div class="topic-metadata">

**Author:** [@ZVerdup](https://discourse.julialang.org/u/ZVerdup)\
**Replies:** 3\
**Last updated:** [February 26, 2025, 5:36pm UTC](https://discourse.julialang.org/t/how-to-collapse-dendrogram-branches-to-n-number-of-leaves/126323 "2025-02-26T17:36:43Z")

</div>

Hi, I need some guidance on how to handle the readability of dendrograms plotted using thousands of observations. I want to use to dendrogram to decide how many clusters I should use for further analysis. My current str…

---

## [Placing dotplot over violin plot](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253)

<div class="topic-metadata">

**Author:** [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Replies:** 6\
**Last updated:** [January 23, 2025, 3:42pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253 "2025-01-23T15:42:41Z")

</div>

I am trying to create a violin plot with the individual data points overlayed over the violin plot. IF I create a violin using Plots.violin(data) and then dotplot!(data) I get a result of side-by-side rather than overlay…

---

## [Control on density plot marker shape and color](https://discourse.julialang.org/t/control-on-density-plot-marker-shape-and-color/124846)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 3\
**Last updated:** [January 21, 2025, 7:12am UTC](https://discourse.julialang.org/t/control-on-density-plot-marker-shape-and-color/124846 "2025-01-21T07:12:47Z")

</div>

I am trying to plot different probability densities on the same plot from a data frame, based on a group. However, there is an overlap on the lines and I need to use different marker shapes and colors for better visibili…

---

## [Groupedhist with missing values](https://discourse.julialang.org/t/groupedhist-with-missing-values/124792)

<div class="topic-metadata">

**Author:** [@mocalvao](https://discourse.julialang.org/u/mocalvao)\
**Replies:** 8\
**Last updated:** [January 17, 2025, 3:13pm UTC](https://discourse.julialang.org/t/groupedhist-with-missing-values/124792 "2025-01-17T15:13:57Z")

</div>

Hi, I have a dataframe df with several columns, among which :P1, whose eltype is Union{Missing,Float64} and :Nome\_Turma, whose eltype is String. I want to make a groupedhist, from StatsPlots.jl (or otherwise), but I get…

---

## [Plotting 2D histogram with different bins for each dimension](https://discourse.julialang.org/t/plotting-2d-histogram-with-different-bins-for-each-dimension/1790)

<div class="topic-metadata">

**Author:** [@rwgardner](https://discourse.julialang.org/u/rwgardner)\
**Replies:** 4\
**Last updated:** [November 2, 2024, 11:11am UTC](https://discourse.julialang.org/t/plotting-2d-histogram-with-different-bins-for-each-dimension/1790 "2024-11-02T11:11:22Z")

</div>

I’m trying to plot a 2D histogram where the 2 dimensions have different bins. I’m currently using marginalhist(x, x, fc=:plasma, bins=\[0.0, 1.0, 2.0\], legend=true) from PlotRecipes (although I’m not tied to that). Th…

---

## [Plots.jl - Plot groups of data on different subplots](https://discourse.julialang.org/t/plots-jl-plot-groups-of-data-on-different-subplots/74477)

<div class="topic-metadata">

**Author:** [@cripcate](https://discourse.julialang.org/u/cripcate)\
**Replies:** 8\
**Last updated:** [October 28, 2024, 8:47am UTC](https://discourse.julialang.org/t/plots-jl-plot-groups-of-data-on-different-subplots/74477 "2024-10-28T08:47:14Z")

</div>

Consider this sample data: using DataFrames, Plots, Random sample\_data = DataFrame(\[rand(10), sample(\['A', 'B', 'C'\], 10)\], \["value", "group"\]) 10×2 DataFrame Row │ value group │ Float64 Char ─────┼────…

---

## [How to show all xlabels in violin plot](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 5\
**Last updated:** [September 21, 2024, 8:11pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627 "2024-09-21T20:11:29Z")

</div>

Hi, In the code below, only evenly indexed labels display. How do I show all xlabels? Thanks! using StatsPlots x = randn(1000, 16) labels = map(x -\> randstring(3), 1:16) violin(permutedims(labels), x, rotation = 90, …

---

## [How to use secondary axis for specific series in a groupedbar plot?](https://discourse.julialang.org/t/how-to-use-secondary-axis-for-specific-series-in-a-groupedbar-plot/118173)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [August 15, 2024, 9:04am UTC](https://discourse.julialang.org/t/how-to-use-secondary-axis-for-specific-series-in-a-groupedbar-plot/118173 "2024-08-15T09:04:32Z")

</div>

Is it possible to specify a secondary y-axis for some of the series in a groupedbar plot ? (I am using Plots.jl/StatsPlots.jl) I have tried to split it in two separate calls with twinxs(), but it doesn’t work: x = \[1 3…

---

## [Custom xticks for dates in StatsPlots groupedbar](https://discourse.julialang.org/t/custom-xticks-for-dates-in-statsplots-groupedbar/118112)

<div class="topic-metadata">

**Author:** [@slwu89](https://discourse.julialang.org/u/slwu89)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 8:33am UTC](https://discourse.julialang.org/t/custom-xticks-for-dates-in-statsplots-groupedbar/118112 "2024-08-13T08:33:47Z")

</div>

Hi all, can someone help me understand why my code is not able to produce a plot with custom xticks for a Date x-axis? I would like to plot the time axis using ticks that are spaced out more widely. using DataFrames, St…

---

## [How to change the background colour of \`fillstyle\`?](https://discourse.julialang.org/t/how-to-change-the-background-colour-of-fillstyle/117815)

<div class="topic-metadata">

**Author:** [@chuljang](https://discourse.julialang.org/u/chuljang)\
**Replies:** 2\
**Last updated:** [August 6, 2024, 9:02am UTC](https://discourse.julialang.org/t/how-to-change-the-background-colour-of-fillstyle/117815 "2024-08-06T09:02:56Z")

</div>

With the StatsPlots package (not with Makie or other packages), I would like to change the background colour of fillstyle, where it has :+, :|, and etc. Is there any way? Alternatively, I wrote the following code which d…

---

## [Bar plot proportions with same bar height = 1](https://discourse.julialang.org/t/bar-plot-proportions-with-same-bar-height-1/117566)

<div class="topic-metadata">

**Author:** [@elisadonati23](https://discourse.julialang.org/u/elisadonati23)\
**Replies:** 6\
**Last updated:** [July 29, 2024, 10:52am UTC](https://discourse.julialang.org/t/bar-plot-proportions-with-same-bar-height-1/117566 "2024-07-29T10:52:45Z")

</div>

Hi all! Quite new into julia and struggling a lot with plots. I am moving from R and I cannot find a way to do a similar plot (using ggplot2) ggplot(propdf, aes(x = date, y = prop, fill = age\_year)) + geom\_bar(stat = …

---

## [Errorline like plot for histograms](https://discourse.julialang.org/t/errorline-like-plot-for-histograms/113911)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 6\
**Last updated:** [June 13, 2024, 2:32pm UTC](https://discourse.julialang.org/t/errorline-like-plot-for-histograms/113911 "2024-06-13T14:32:53Z")

</div>

I would like to create an envelope plot for multiple histogram (input as matrix) something like what is done with errorline in StatsPlots. (I did not find a Makie equivalent of errorline). Basically, what I want would l…

---

## [How to extract box centers from a boxplot (StatsPlots.jl)](https://discourse.julialang.org/t/how-to-extract-box-centers-from-a-boxplot-statsplots-jl/113417)

<div class="topic-metadata">

**Author:** [@JonathanH](https://discourse.julialang.org/u/JonathanH)\
**Replies:** 0\
**Last updated:** [April 24, 2024, 2:32am UTC](https://discourse.julialang.org/t/how-to-extract-box-centers-from-a-boxplot-statsplots-jl/113417 "2024-04-24T02:32:37Z")

</div>

I have some code (attached) for generating a box plot overlayed with a “jitter” plot (Jittered points — geom\_jitter • ggplot2) – that is, each box has a bunch of scatter points that are aligned with it. I am trying to ex…

---

## [How can i plot a Correlation HeatMap?](https://discourse.julialang.org/t/how-can-i-plot-a-correlation-heatmap/78411)

<div class="topic-metadata">

**Author:** [@folleyz](https://discourse.julialang.org/u/folleyz)\
**Replies:** 8\
**Last updated:** [March 13, 2024, 6:34am UTC](https://discourse.julialang.org/t/how-can-i-plot-a-correlation-heatmap/78411 "2024-03-13T06:34:52Z")

</div>

Hello Guys! I need a help. i want make this heatmap: I’m trying with that code: Plots.heatmap(cor(Matrix(df\[!,\[:Age,:Balance, :Tenure,:NumOfProducts,:EstimatedSalary\]\])) ) \*\* But how can i put the annotations o…

---

## [Failing to plot correlograms in Julia: Makie vs. AoG vs StatsPlots](https://discourse.julialang.org/t/failing-to-plot-correlograms-in-julia-makie-vs-aog-vs-statsplots/107971)

<div class="topic-metadata">

**Author:** [@enzomar](https://discourse.julialang.org/u/enzomar)\
**Replies:** 30\
**Last updated:** [December 30, 2023, 1:00am UTC](https://discourse.julialang.org/t/failing-to-plot-correlograms-in-julia-makie-vs-aog-vs-statsplots/107971 "2023-12-30T01:00:47Z")

</div>

I am trying with any possible package to plot a classic correlation plot (scatterplots for each variable vs each other and density histogram on the diagonal in the middle). Sometime they are cold correlogram or pairplots…

---

## [Grouped boxplot - https://github.com/JuliaPlots/StatsPlots.jl/pull/192](https://discourse.julialang.org/t/grouped-boxplot-https-github-com-juliaplots-statsplots-jl-pull-192/44655)

<div class="topic-metadata">

**Author:** [@Ibrahim-a-Ibrahim](https://discourse.julialang.org/u/Ibrahim-a-Ibrahim)\
**Replies:** 7\
**Last updated:** [November 10, 2023, 6:37pm UTC](https://discourse.julialang.org/t/grouped-boxplot-https-github-com-juliaplots-statsplots-jl-pull-192/44655 "2023-11-10T18:37:25Z")

</div>

I have a 3D array (24×3×3 Array{Float64,3}) as follows: x=rand(24,2,3) How can I plot a grouped boxplot for x as shown in the following figure?

---

## [What does \`density()\` do when applied to a \`Distribution\` directly?](https://discourse.julialang.org/t/what-does-density-do-when-applied-to-a-distribution-directly/105621)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 6\
**Last updated:** [November 1, 2023, 10:18pm UTC](https://discourse.julialang.org/t/what-does-density-do-when-applied-to-a-distribution-directly/105621 "2023-11-01T22:18:12Z")

</div>

I just started experimenting with Distributions.jl and StatsPlots.jl, and made a basic mistake, writing density(Normal()) instead of density(rand(Normal(), 100\_000)) or plot(Normal()). When executing julia\> plot(Normal(…

---

## [Ordering labels across subplots](https://discourse.julialang.org/t/ordering-labels-across-subplots/105251)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [October 20, 2023, 10:11pm UTC](https://discourse.julialang.org/t/ordering-labels-across-subplots/105251 "2023-10-20T22:11:15Z")

</div>

Hi, I would like to add the same label to two subplots. In the example below, the densities and colors are correct, but the label should be 1 2 3 4 for each subplot. Is there a way to correct this issue? Thanks! using…

---

## [How to scale the density of violin plot](https://discourse.julialang.org/t/how-to-scale-the-density-of-violin-plot/104737)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [October 9, 2023, 11:06am UTC](https://discourse.julialang.org/t/how-to-scale-the-density-of-violin-plot/104737 "2023-10-09T11:06:58Z")

</div>

I would like to use a violin plot to display density information. For the x-axis, the scaling matters. However, only the shape of the densities matter. How can I rescale the densities to prevent occlusion? Here is a si…

---

## [How can I change the fontsize of the colorbar's label in Plots.jl?](https://discourse.julialang.org/t/how-can-i-change-the-fontsize-of-the-colorbars-label-in-plots-jl/103108)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 6\
**Last updated:** [August 23, 2023, 5:55pm UTC](https://discourse.julialang.org/t/how-can-i-change-the-fontsize-of-the-colorbars-label-in-plots-jl/103108 "2023-08-23T17:55:55Z")

</div>

Hi all, I have a 2D matrix that I want to plot as an heatmap. It is quite big though (58x58), so plotting it with function pairwise\_difference(v::Vector)::Matrix \[x - y for x in v, y in v\] end measures\_vec = \[t.mea…

---

## [Why are these violin plots "clipped"?](https://discourse.julialang.org/t/why-are-these-violin-plots-clipped/103006)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 7\
**Last updated:** [August 21, 2023, 9:09am UTC](https://discourse.julialang.org/t/why-are-these-violin-plots-clipped/103006 "2023-08-21T09:09:37Z")

</div>

Hi all, I produced some violin plots from some data I have: df\_temp = DataFrame(mnemonic = df\_model\_master\[:, :mnemonic\], instruction = df\_model\_master\[:, instruction\_sym\], shift = df\_model\_master\[:, has\_barrel\_…

---

## [How can I show the mean in a groupedboxplot?](https://discourse.julialang.org/t/how-can-i-show-the-mean-in-a-groupedboxplot/102980)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 4\
**Last updated:** [August 20, 2023, 4:03pm UTC](https://discourse.julialang.org/t/how-can-i-show-the-mean-in-a-groupedboxplot/102980 "2023-08-20T16:03:16Z")

</div>

Hi all! I have this kind of DataFrame containing data: julia\> df\_filtered = filter(:mnemonic =\> m -\> m ∈ selected\_instructions, df\_temp) 1990×4 DataFrame Row │ mnemonic instruction forwarding value …

---

## [Plotting Probability Distribution of Data](https://discourse.julialang.org/t/plotting-probability-distribution-of-data/99976)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 3\
**Last updated:** [June 7, 2023, 5:45pm UTC](https://discourse.julialang.org/t/plotting-probability-distribution-of-data/99976 "2023-06-07T17:45:26Z")

</div>

I am trying to produce a plot of probability distribution function of some data which is a result of simulations. Using density function from StatPlots is showing some weird y-axis numbers. I would expect it to be rangin…

[Next page](https://discourse.julialang.org/tag/statsplots/402.md?match_all_tags=true&page=1&tags%5B%5D=statsplots)
