2
$\begingroup$

I have a DateListStepPlot. The abscissa is meaningfully labeled. However, on the ordinate axis, the labels just show numbers. But I want to show their unit too (e.g. °C or € or whatsoever).

How can I achieve this? There will be an option to add such labels to the labels, I guess.

Which is the right one and can do I have to use it?

For example:

li2={{DateObject[{2022, 3, 7}, "Day", "Gregorian", "Europe/Berlin"], 6858.76}, {DateObject[{2022, 3, 8}, "Day", "Gregorian", "Europe/Berlin"], 20294.8}, {DateObject[{2022, 3, 9}, "Day", "Gregorian", "Europe/Berlin"], 29719.8}, {DateObject[{2022, 3, 10}, "Day", "Gregorian", "Europe/Berlin"], 36544.8}, {DateObject[{2022, 3, 11}, "Day", "Gregorian", "Europe/Berlin"], 39694.8}, {DateObject[{2022, 3, 12}, "Day", "Gregorian", "Europe/Berlin"], 41344.8}, {DateObject[{2022, 3, 13}, "Day", "Gregorian", "Europe/Berlin"], 44794.8}, {DateObject[{2022, 3, 14}, "Day", "Gregorian", "Europe/Berlin"], 45894.8}, {DateObject[{2022, 3, 15}, "Day", "Gregorian", "Europe/Berlin"], 47319.8}, {DateObject[{2022, 3, 16}, "Day", "Gregorian", "Europe/Berlin"], 47619.8}, {DateObject[{2022, 3, 17}, "Day", "Gregorian", "Europe/Berlin"], 48839.8}, {DateObject[{2022, 3, 18}, "Day", "Gregorian", "Europe/Berlin"], 49739.8}, {DateObject[{2022, 3, 19}, "Day", "Gregorian", "Europe/Berlin"], 50339.8}, {DateObject[{2022, 3, 20}, "Day", "Gregorian", "Europe/Berlin"], 50439.8}, {DateObject[{2022, 3, 21}, "Day", "Gregorian", "Europe/Berlin"], 50489.8}, {DateObject[{2022, 3, 22}, "Day", "Gregorian", "Europe/Berlin"], 50694.8}, {DateObject[{2022, 3, 23}, "Day", "Gregorian", "Europe/Berlin"], 51454.8}, {DateObject[{2022, 3, 25}, "Day", "Gregorian", "Europe/Berlin"], 51634.8}, {DateObject[{2022, 3, 26}, "Day", "Gregorian", "Europe/Berlin"], 52634.8}, {DateObject[{2022, 3, 28}, "Day", "Gregorian", "Europe/Berlin"], 52984.8}, {DateObject[{2022, 3, 29}, "Day", "Gregorian", "Europe/Berlin"], 53234.8}, {DateObject[{2022, 3, 30}, "Day", "Gregorian", "Europe/Berlin"], 54434.8}, {DateObject[{2022, 3, 31}, "Day", "Gregorian", "Europe/Berlin"], 55134.8}, {DateObject[{2022, 4, 3}, "Day", "Gregorian", "Europe/Berlin"], 56134.8}, {DateObject[{2022, 4, 4}, "Day", "Gregorian", "Europe/Berlin"], 56294.8}, {DateObject[{2022, 4, 5}, "Day", "Gregorian", "Europe/Berlin"], 56844.8}, {DateObject[{2022, 4, 6}, "Day", "Gregorian", "Europe/Berlin"], 57364.8}, {DateObject[{2022, 4, 8}, "Day", "Gregorian", "Europe/Berlin"], 57364.8}}; DateListStepPlot[li2, PlotRange->All, AxesLabel->{"€",""}, PlotLabel->"Fundraising"]

Strangely the AxesLabel are not shown (why)? But I would prefer the € sign directly following the € amounts on the ordinate axe's labels.

$\endgroup$
0

1 Answer 1

4
$\begingroup$

As an example:

data = {Quantity[10, "Millibars"], Quantity[12, "Millibars"], 
  Quantity[14, "Millibars"], Quantity[18, "Millibars"], 
  Quantity[20, "Millibars"]}

dates = {DateObject[{2022, 1, 1}], Automatic, "Month"}

DateListStepPlot[data, dates
 , FrameLabel -> Automatic
 , FrameTicks -> {
   {Automatic
    , {#, Quantity[#, "Millibars"]} & /@ Range[0, 20, 5]
    }
   , {Automatic, None}
   }]

enter image description here


EDIT - to include OP's particular use case

Let data be the data:

DateListStepPlot[data, PlotRange -> All, FrameLabel -> Automatic
 , FrameTicks -> {
   {{#, Quantity[NumberForm[#, DigitBlock -> 3], "Euros"]} & /@ 
     Range[0, Round[First@Max[alist], 10000], 10000]
    , Automatic}
   , {Automatic, None}
   }
 , PlotLabel -> "Fundraising"]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for the accept. $\endgroup$
    – Syed
    May 7, 2022 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.