Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Box plot overlaid with dot/line plot

    Hi,

    I want to produce a box plot (over two categories) & add or overlay a plot with another meaningful value (eg, a box plot of the median/IQR product prices by country and category overlaid with the total volume of sales).

    I am having some difficulties overlaying the two plots. I see that you cannot use addplot with box plots (or use twoway). I have looked at other answers which suggest using stripplot (SSC) but I cannot seem to apply it correctly. I am using Stata 14.2.

    I have used an example dataset to try to describe my problem:

    Code:
    // using
    sysuse auto, clear
    gen group = mpg<20
    
    // run boxplot
    graph hbox price [aw=weight],    ///
        noout asy                     ///
        over(group)                 ///
        over(rep78)
    
    // run dotplot
    graph dot (sum) weight,        ///
        over(group)                ///
        over(rep78)
    These are similar to the two graphs I want to draw with my data - but I can't work out how to overlay them. Do you have any advice on how to approach this? The second plot does not have to be a dot plot - it could be a line/connected graph for example.

    I really appreciate any help on this,
    Bryony

  • #2
    I can’t imagine how this graph would make any sense overlaid. I suggest using graph combine.

    Comment

    Working...
    X