If your x-axis data (first column in your data matrix) is in the form 100000 m
, as in the following fake data
dt1a = Sort@ Transpose[{Quantity[RandomInteger[10^4, 100], "Meter"], RandomReal[100, 100]}];
then you can use UnitConvert
on the first column of your data:
dt1b = MapAt[UnitConvert[#, "Kilometer"] &, dt2, {All, 1}];
Plotting the two data sets side by side
llp1a = ListLinePlot[dt2a, ImageSize -> 300, Frame -> True];
llp1b = ListLinePlot[dt2b, ImageSize -> 300, Frame -> True];
Row[{llp2, llp2b}, Spacer[5]]
Alternatively, you can use FrameTicks
or Ticks
(depending on whether have a Frame in your plot) to format the tick labels as follows:
dt2 = Sort@Transpose[{RandomInteger[10^4, 100], RandomReal[100, 100]}];
llp2a = ListLinePlot[dt2, ImageSize -> 300, Frame -> True];
llp2b = ListLinePlot[dt2, ImageSize -> 300, Frame -> True,
FrameTicks -> {{Automatic, None},
{{#, #/1000} & /@ Range[0, 10000, 1000], None}}];
llp2c = ListLinePlot[dt2, ImageSize -> 300, Frame -> True,
FrameTicks -> {{Automatic, None},
{{#, Row[{#/1000, " km"}]} & /@ Range[0, 10000, 1000], None}}];
Row[{llp2a, llp2b, llp2c}, Spacer[5]]
Related Q/As: Number format of axes in a plot
UnitConvert[Quantity[10^7,"Meters"],"Kilometers"]
$\endgroup$