0

I have a graph that renders some geometric configuration. And I would like all values (ticks) on the x-axis to be positive, even if the point values are negative. How can I achieve this?

My current axis configuration: `

xaxis: {
            title: {
                text: 'Position, m',
            },
            range: [axisMinX, axisMaxX],
            gridcolor: "rgb(229,229,229)",
            showgrid: true,
            showline: false,
            showticklabels: true,
            tickcolor: "rgb(127,127,127)",
            ticks: "outside",
            zeroline: false,
            autorange: "reversed"
        }

`

Also I found a suitable answer for Plotly Python (answer link). Is it possible to reproduce it in JS somehow?

  • Add `ticktext = list(x_ticks)` to xaxis where `x_ticks` are all the positive values you want. – Hamzah Dec 03 '22 at 08:37
  • The use of `ticktext` requires that you also set `tickvals`. (Tick text is what you want to see; tick values are the actual values on the axis.) – Kat Dec 08 '22 at 05:26

0 Answers0