Announcement

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

  • Changing Axis Range - Pre Saved .gph

    Hi
    Im having an issue with a pre saved graph. I would like to change the range of mye y-axis. Someone that could help?

    The graph´s yaxis is currently going from -50 to 0. However, I would like it to go from only -5 to 2.
    I have tried to use the gr_edit command, but it is not that much info out on the command.

    I dont know if I am totally of track, but I have tried different methods like this:

    graph use plot1.gph
    gr_edit .yaxis1.plotregion.yscale = (-5(1)2)

    I have also tried changing it directly in graph editor, but all numbers in the y axis is having a plus-sign after it, and it says: (+) denotes ticks defined by the rule; these cannot be deleted.

    The graph it self took 24 hours to make, so i would prefer not to redo the graph with an ylab command.
    I am open for any suggestions.
    HH

  • #2
    Do you simply want to relabel the axis or you want to show a subset of the data? The latter will require that you create the graph again. Can you post the graph in gph format?

    Comment


    • #3
      Okey, thanks!
      No need to send the graph then, I will just create a new graph.
      Thank you for the help.

      Comment


      • #4
        Depending on how complicated your graph code is, it is possible to extract data from the graph (gph format) and quickly recreate the wanted graph. But here is the main idea (highlighted):

        Code:
        sysuse auto, clear
        set seed 11282020
        gen x=runiformint(-50, 0)
        scatter price x, scheme(s1color) saving(gr1, replace)
        scatter price x if inrange(x, -5, 2), scheme(s1color) xlab(-5/2) saving(gr2, replace)
        gr combine gr1.gph gr2.gph, scheme(s1color)
        Res.:
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.8 KB
ID:	1583782

        Last edited by Andrew Musau; 28 Nov 2020, 07:14.

        Comment

        Working...
        X