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

Re: st: graphics complaints

From (Chinh Nguyen, StataCorp)
Subject   Re: st: graphics complaints
Date   Thu, 19 Nov 2009 14:13:41 -0600

David Airey <david.airey@Vanderbilt.Edu> reports that the resolution of Stata
graphs on the Mac sometimes leads to visual artifacts,

> Stata 11 on OS X has a couple graphics rendering problems that
> sometimes show up:
> (1) plotting symbols (e.g., circles) are sometimes oblong either 
>     horizontally or vertically in the same plot
> (2) lines are sometimes very jagged
> Sometimes this translates to exported figures too.

The artifacts that David reports occur on graphs drawn to the screen and
graphs exported as PDF files.  To clarify, they do not occur on graphs
exported as EPS files.

Some of these problems occur because of screen resolution and others because
of how we are invoking drawing functions on the Mac.  We can fix how we invoke
drawing functions but not screen resolution.  Specifically,

      With regard to oblong circles, this can be fixed both on
      the screen and in PDF files.

      With regard to jagged lines on the screen, the jaggies
      arise mostly because of screen resolution.  We will make
      this better, but this cannot be entirely corrected at
      screen resolution.

      With regard to jagged lines in PDF files, we can and will
      correct them.

We will fix these behaviors in a future executable update.

In this same thread Friedrich Huebler <> writes that 
-twoway function- can produce jaggy lines, even under Windows,

> A y=x line drawn with -twoway function- is not as straight as a line
> drawn with -twoway scatter, connect-. The difference can be
> illustrated with the following commands.

> . clear
> . set obs 2
> . gen x = .
> . replace x = 0 in 1
> . replace x = 100 in 2
> . gen y = .
> . replace y = 0 in 1
> . replace y = 100 in 2
> . twoway (scatter y x, connect(l) clwidth(thin)) (function y=x+1,
>          range(0 100) lwidth(thin)), aspect(1)
> The -function- line is uneven and can indeed be described as
> "shocked with electricity", to use Dave's words. Is it possible to
> draw a -function- line as straight as a -scatter, connect- line?

This is an unrelated issue.  

As David noted in this thread, -twoway function- draws its functions using 300
points equally spaced in the X dimension.  At screen resolution, that leads to
jaggy lines because the entire graph is rarely much more than 300 pixels wide
on the screen.  

Because Friedrich wants to draw a straight line rather than a curve, the most
accurate way to do that is with only 2 points in the X dimension.  His
function line will look much better if he adds option -n(2)- to his function

   -- Chinh Nguyen               -- Vince Wiggins   

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index