Вопрос

I'm trying to graph some data points. The X coordinates tend to be inversely proportional to the Y coordinates, so I decided to try graphic in '1/x' space (replace every x with 1/x).

This makes the graph a lot more evenly spaced, but there's a problem: I'm not sure how to pick where the tick marks / grid lines should go.

Here's an example graph (with points labelled by their original X coordinate):

Graph in inverse space

In the above example I spaced the tick marks evenly (in the original space). They end up too clustered near the left (infinity) and too dispersed near the right. Is there a nice rule for where I should increase the spacing?

Just a link to other 'inverse space' graphs would be useful, so I can see how they placed ticks.

Это было полезно?

Решение

What I ended up doing was:

  • Place a major tick at every power of 10, until you get really close to the origin (infinity). Also place a major tick at infinity.
  • Place 9 minor ticks between each major tick, corresponding to changing the most significant digit. So 2,3,4,...9 between 1 and 10. 20,30,40,...,90 between 10 and 100.
  • Place labels on every major tick, until they get too close.
  • Also place labels on minor ticks, from right to left, whenever there's room.

The result looks like this:

Fancy ticks

Which is not great (and the colors aren't quite right), but it's good enough for my purposes for now.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top