Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Apostrophe in labels breaks graph


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Apostrophe in labels breaks graph
Date   Sat, 25 Jun 2011 19:30:44 -0400

I am working on a graph that has French labels with apostrophes. These
apostrophes break the graph, as the code below demonstrates. The graph
in the example is meaningless, I only use the auto data to visualize
the problem.

clear all
sysuse auto
graph hbar mpg trunk turn, over(foreign) ///
  legend(row(1) span) stack name(one)
lab def origin 0 "Europe de l'Ouest" ///
  1 "Asie de l'Est", modify
graph hbar mpg trunk turn, over(foreign) ///
  legend(row(1) span) stack name(two)
graph hbar mpg trunk turn, over(foreign) ///
  legend(row(1) span) stack name(three) ///
  graphregion(margin(30 3 3 3))
graph hbar mpg trunk turn, over(foreign, ///
  relabel(1 `""Europe de" "l'Ouest""' ///
  2 `""Asie de" "l'Est""')) ///
  legend(row(1) span) stack name(four)

Graph one shows the layout that I need. In graph two the labels are
mostly invisible.

Graph three shows the labels, but only by adding extra margin on the
left side. The problem with this solution is that -legend(span)- no
longer has the desired effect because the legend stays below the
horizontal axis in the graph.

Graph four shows the labels, as well as the spanned legend, but I
didn't manage to create this graph with the region names in a single
line, as in graph three.

Is it possible to show the labels with the apostrophes in a single
line, with a legend that spans the entire width of the graph? I found
no solution in the documentation or the Statalist archive. I also
tried editing individual labels in the Graph Editor but the labels
disappear as soon as I enter a label with an apostrophe.

Thanks,

Friedrich
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index