Announcement

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

  • Venn diagrams with pvenn

    Hello Statalisters,

    I thought I'd try to present some descriptive data in a graphical form rather than in a dense table. I am exploring using pvenn to create some Venn diagrams after a series of factor analyses. I have several questions for anyone who has experience with pvenn.

    1) Does anyone know how to add value labels to indicate the proportion residing inside and/or outside the intersection areas?

    2) Does anyone know how to manipulate other aspects elements of the graph, e.g. line color and style? I am inconvenienced by the lack of documentation for this add in; If anyone could direct me to more documentation/instructions, I'd be grateful. My current code is very bare-bones, simply:
    pvenn marcon EVPVany SVany
    graph save "Venn_`c'", replace
    This produces a Venn with red, green, and gold lines. I'd like to be able to customize the colors for presentations and convert to black and white solid / dashed lines for B&W printing. I'd also like to make changes to the variable labels and legend.

    3) I am also repeating the Venns on a series of samples (separate datasets) and want to present the diagrams as a set of small multiples for comparison purposes. For most of the resulting diagrams, I am able to plot the total population, indicated by a rectangular border showing the proportion of the total sample lying outside of the two-three variables in the Venn ellipses. However, for up to one third of my diagrams, I cannot plot the total population. This is because proportion experiencing one or more of the "Venned" variables is so high that the area outside the ellipses can't be represented proportionally. My question is this: Is there any way to "trick" it into plotting the total population by altering the scale of the area outside the ellipses (say 2:1) while keeping the scale within any of the ellipses as is (1:1)? I.e. each unit of area within an ellipse would represent one case, but each unit of area outside (between the ellipses and the border) would represent 0.5 cases. [If so, obviously I would use the same altered scale on all items in the small multiple set.]

    Thank you!
    Kerry

  • #2
    I've never used pvenn (SSC, as you are asked to explain) but with #3 especially I doubt you will make any progress this way as at first glance you want a radical generalisation. The help file seems very good, so the complaint about documentation seems a little harsh.

    I can suggest a quite different alternative. designplot (SSC) can be used to show frequencies of any or all of the 0-way breakdown (all observations specified), the 1-way breakdowns, the 2-way breakdowns, etc. It doesn't offer Venn diagrams but it does extend way beyond the 1, 2 or 3 binary variable set-up of pvenn.

    With the leading example of pvenn we can go

    Code:
    sysuse nlsw88, clear
    designplot idcode never_married collgrad south, stat(count) recast(hbar) min(3) max(3) t1("")
    designplot idcode never_married collgrad south, stat(count) recast(hbar) t1("") ysize(7)
    Here idcode is a response that is ignored in the graph, but needed to placate the program, which needs a response variable. It just needs to be a variable non-missing wherever the variables shown are.


    The first graph shows the 8 subsets of the 3 binary variables.


    Click image for larger version

Name:	design1.png
Views:	1
Size:	15.6 KB
ID:	338440


    The second graph shows breakdowns at all scales.

    Click image for larger version

Name:	design2.png
Views:	1
Size:	14.6 KB
ID:	338442



    The program offers an option to save the data used in graphing. If you needed a nonlinear scale that might be useful. Standard graph options allow frequencies to be added.

    Last edited by Nick Cox; 20 Oct 2014, 14:21.

    Comment


    • #3
      Thanks. For my purposes, I definitely want to produce proportional Venns. I have figured out most of the line style settings that I want. But if anyone has guidance on how to add value labels to the plot, I would be grateful.

      Comment


      • #4
        Understood. My small prejudice is that these displays are harder to decode than one would like, but that's not your question.

        I've never even used pvenn but the help makes clear that there is a plabel() option you can use to pass text. It won't work differently according to whether the text is a value label or a variable label or not. I don't know why you mention value labels as the set up appears to be that you supply one, two or three variables.

        You could just type in the text wanted or you could refer to value or variable labels indirectly using standard syntax. See help extended_fcn

        Comment


        • #5
          Hi Statalist,

          I've also got a few problems with the pvenn command that I've not been able to solve and thought I'd append my questions to the post above given they are related. I'm working in Stata 13.1 and my questions are as follows:

          Issue #1 I'm trying to add labels using the plabel option but it doesn't seem to be adding anything to the resulting figure, either to the circles or to the legend when turned on (see code below). When I make up a manual venn diagram however, the labels work. Where am I going wrong?

          Issue #2 Is there a way to change the size of the figure under the pvenn command, or do I have to use the graph display command after running the pvenn command?

          Issue #3 I would like to fill in the overlap portions of the venn diagram but this feature isn't mentioned in the help file. Is this possible?

          Thanks in advance all!

          Code:
          pvenn var1 var2 var3, 
              drawtotal(0)
              drawlabel(1)
              plabel("Apple" "Pear" "Orange")
              lw(medthick)
              lc("ebblue emidblue dknavy")
              graphregion(
              ifcolor(white)
              ilcolor(white)
              fcolor(white)
              lcolor(white))
              legend(off)
              yscale(off)
              xscale(off)
          ;
          #delimit cr

          Comment

          Working...
          X