Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am using the Plot function in a usual way. I use Mathematica 9.0.1.0 in English (I do not know if it is available in other languages, but I do not mind), and as a result of that, the numbers that appear in the frame tick labels use dots as decimal markers.

I need all numbers in the plot to be shown with a comma as a decimal marker. Is that possible?

Here you have a MWE —nothing special:

Plot[Sin[x], {x, 0, 10}, PlotRange -> Automatic, Frame -> True, 
 Axes -> False, AspectRatio -> 1/GoldenRatio, ImageSize -> 600, 
 Frame -> True, FrameTicks -> Automatic, 
 LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 12]]

This is what I get:

Minimum Working Example

This is a minor issue, as I can export the image and change its labels outside Mathematica, but in case I would like to do this inside Mathematica, how could I get it?

ADDITIONAL INFORMATION:

I've tried it by using $Language = "Spanish", with no success.

share|improve this question
1  
LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 12, NumberPoint -> ","]? –  kguler Jul 8 at 17:15

3 Answers 3

up vote 4 down vote accepted

You can also use the option NumberPoint->"," as a sub-option in LabelStyle:

Plot[Sin[x], {x, 0, 10}, PlotRange -> Automatic, Frame -> True, 
    Axes -> False, AspectRatio -> 1/GoldenRatio, ImageSize -> 600, 
    Frame -> True, FrameTicks -> Automatic, 
LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 20, Red, NumberPoint -> ","]]

enter image description here

Or use BaseStyle -> (NumberPoint -> ","):

 Plot[Sin[x], {x, 0, 10}, PlotRange -> Automatic, Frame -> True, 
    Axes -> False, AspectRatio -> 1/GoldenRatio, ImageSize -> 600, 
    Frame -> True, FrameTicks -> Automatic, 
    BaseStyle -> (NumberPoint -> ","),
    LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 20, Red]]

 (* same picture *)
share|improve this answer
    
I just found the same solution at the same time! Thank you! –  Vicent Jul 8 at 17:26
1  
@Vicent, "Great minds ..." / Mr.Wizard :) Welcome to MMMSE. –  kguler Jul 8 at 17:34

First, you can use Style:

Style[
 Plot[Sin[x], {x, 0, 10}, PlotRange -> Automatic, Frame -> True, 
  Axes -> False, AspectRatio -> 1/GoldenRatio, ImageSize -> 600, 
  Frame -> True, FrameTicks -> Automatic, 
  LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 12]],
 NumberPoint -> ","]

enter image description here

Second, you can set it globally in Preferences > Appearance > Numbers > Formatting.

Third, you can select the output cell and use the Options Inspector to set the NumberPoint option for the cell.

share|improve this answer
    
OK! Thanks! In fact, I have just found the answer at the same time. This is an alternative, putting NumberPoint within the LabelStyleoption: Plot[Sin[x], {x, 0, 10}, PlotRange -> Automatic, Frame -> True, Axes -> False, AspectRatio -> 1/GoldenRatio, ImageSize -> 600, Frame -> True, FrameTicks -> Automatic, LabelStyle -> Directive[FontFamily -> "Calibri", FontSize -> 12, NumberPoint -> ","]] –  Vicent Jul 8 at 17:19
    
@Vincent Cool. I didn't try LabelStyle. You can put that in your own answer. Some other users might look only at the answers and not at the comments. –  Michael E2 Jul 8 at 17:24
    
Another user gave the same answer than me. If you don't mind, I am going to give him the "mark". –  Vicent Jul 8 at 17:28
2  
@Vicent No problem. Actually, it's good practice to wait (at least a few hours) before accepting. You encourage more answers that way, and sometimes the best one is not the first one. –  Michael E2 Jul 8 at 17:30
    
I'm including this to BaseStyle :) –  Kuba Jul 8 at 18:40

To apply the comma to several plots, resp. to any output:

$Post = Style[#, NumberPoint -> ","] &

Grid[{Plot[#@x, {x, 0, Pi}] & /@ {Cos, Sin, Tanh}}]

enter image description here

$Post=. (* Reset *)

You can customize the NumberPoint also via Option Inspector (Menu "Format")

share|improve this answer
    
Wow, thank you! –  Vicent Jul 8 at 19:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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