How to interchange x-y axis values


I use LibreOffice in Ubuntu Studio 19.10 (64 bits Linux).

I made a Calc spreadsheet with the standard values of the Atmospheric Pressure according the Altitude over the sea level.

I put the Altitude values (meters) in the first column A. I put the Pressure values in the second column B.

I get a very nice graphic (as you can see in the attached file), BUT…

I wonder… How can I interchange the axis values? I mean… To put the Altitude (meters) in the Y axis, and the Pressure values in the X axis.

How can I get this?

BTW: I think this option should be present in the first steps of the Graphic Assistant. Just an idea.

Variación de la Presión Atmosférica según altura sobre el nivel del mar.ods


Introducing Comment For scientific, mathematical data based on numeric values for both axis, I’d recommend to use XY (Scatter) chart type.

To convert X-Y on your chart, perform the following:

  • Double Click the chart
  • Right click -> Data Ranges
  • Select Y-Values in pane titled Data ranges (see Screenshot Before)
  • Replace Range for Y-Values (initial value $Gráfico.$B$3:$B$103) by: $Gráfico.$A$3:$A$103
  • Replace Categories (initial value $Gráfico.$A$3:$A$103) by: $Gráfico.$B$3:$B$103 (see Screenshot After)
  • Click OK

Screenshot Before

image description

Screenshot After

image description

See also Modified File: Barometric-Modified.ods

Due to the fact that you overwrote option [x] Automatic in scaling you need to adapt, which obviously you know about how to do that.

[Update] Turned chart to XY(Scatter)-type

The following file contains your chart turned to XY (Scatter)-type and some adaptions to the x-axis and y-axis, which you easily can modify by double click on the axis (acitvate) and Right click -> Format axis and to fit your needs.


Hope that helps.

If the answer helped to solve your problem, please click the check mark (:heavy_check_mark:) next to the answer.

Thank you so much for your help!

Now, I have the meters in the Y axis and the mm Hg in the X axis, as I wanted.

But… I still have a problem: It was not my decision to use an automatic X axis scale. This option appears inside the “Scale” tab of the “Edit Axis” options, with the “Text” and “Date” options and I don’t know how to change it.

I’d want to change it to a linear numeric scale, but… I cannot to find how to change it! So…

It was not my decision to use an automatic X axis scale.

It was me changing to automatic to simplify - the uploaded file was set to non-automatic special values. But I did not change the chart type according to the comment at the beginning of my answer!

If I understand you right - you want the pressure from lower values to higher values? And if this is true you have one of the problems, why I suggested to use XY (Scatter) type of chart. A line-type of chart works with Categories (like apples, cherries, pears, etc…) on the x-axis which are not numerical values and is not suited for numerical, scientific data. Please check the Update to my answer, where I turned your chart into an XY (Scattter)-type of chart.

Thank you so much!!!
I use the XY (Scatter) kind of graphic and… Now I get what I wanted!!!
Thank you so much!!!

Thanks Opaque comments, the final solution is…

To use the XY (Scatter) kind of graphic.

See the final file, with the full tables and graphics.

ATMÓSFERA NORMAL - Variación de la Presión y la Temperatura según altura sobre el nivel del mar.ods

Blessings and Greetings from Chile!!!

Despite the problem was briliantly solved by @anon73440385

I wonder... How can I interchange the axis values? I mean... To put the Altitude (meters) in the Y axis, and the Pressure values in the X axis.

You should only swap A column values and B column values and X axis and Y axis will show the change. It is the simpler way (and tested by my students… :wink: )

Of course XY scatter is the best way of visualizing your data…