Announcement

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

  • How to obtain different font sizes in the same line of a graph title?

    dear Statalisters,

    My aim is to produce a graph title with different font sizes, something like this:

    Age=65 years and eGFR=30 mL/min per 1.73m2

    because the unit for eGFR is so long that it takes half the space if I don't reduce its fontsize. The problem is that I cannot split the title between the number and the unit measure, it would be very awkward to read.

    I guess the solution would be to use some SMCL trick, but I haven't found anything helpful in the Stata manual for my problem

    thank you for your attention

    Dino



  • #2
    Code:
    scatter mpg weight, title(Age=65{sub:years} and eGFR=30{sub:mL/min per 1.73m{c 178}} )

    Comment


    • #3
      Crossed with #2: Nice solution Scott!

      If using the same font, I don't think that you can do this within the title() option. However, you may use the text() option several times, but this will need some tweaking to obtain the desired result

      Code:
      sysuse auto
      scatter price mpg, text(16500 12 "Age=65") text(16500 14.5 "years", size(tiny)) ///
      text(16500 16 "and", size(small)) text(16500 19 "eGFR=30")  ///
      text(16500 23 "mL/min per 1.73m2", size(tiny))
      Click image for larger version

Name:	text.png
Views:	1
Size:	47.8 KB
ID:	1462323

      Comment


      • #4
        thank you very much Scott and Andrew!

        I think Andrew's solution, albeit laborious, is fine because it should allow to text resizing in a more flexible way, also using appropriately the textbox coordinates.

        Well, this is definitely a minor issue, but, given the attention that Stata recently devoted to graph quality, it could be listed in the Stata 16 wishlist




        Comment

        Working...
        X