1
$\begingroup$

I'm struggling with parametric plot axes ticks edition. I need them to always have one (or two) digits after the coma but now they are like: 0,6 0,8 1, 1,2 1,4 and I need the to be like: 0,6 0,8 1,0 1,2 1,4... Please help!

Example of the code:

f[x_] := x
g[x_] := x

ticksX = Table[x, {x, 0, 4, 0.2}];
ticksY = Table[x, {x, 0, 4, 0.1}];
grids = {Table[x, {x, 0, 3, 0.1}], Table[x, {x, 0, 3, 0.1}]};

Style[ParametricPlot[{f[x], g[x]}, {x, 0, 3}, 
  PlotStyle -> {Thickness[0.003], Black}, 
  AxesLabel -> {Style["n", FontSize -> 12.5, Italic, 
     FontFamily -> "Times"], 
    Style["m", FontSize -> 12.5, Italic, FontFamily -> "Times"]}, 
  AxesOrigin -> {0, 0}, PlotRange -> All, AspectRatio -> Automatic, 
  GridLines -> grids, Ticks -> {ticksX, ticksY}, 
  TicksStyle -> Directive[Black, 12.5, FontFamily -> "Times"], 
  GridLinesStyle -> {{Gray, Directive[Thickness[0.001]]}, {Gray, 
     Directive[Thickness[0.001]]}}, 
  AxesStyle -> {{Black, Directive[Thickness[0.002]]}, {Black, 
     Directive[Thickness[0.002]]}}], NumberPoint -> ","]

the problem

$\endgroup$

1 Answer 1

3
$\begingroup$

something like this? See help for more details on these number formatting functions.

Mathematica graphics

ticksX = Table[{x, 
    Rotate[Style[NumberForm[x, {2, 1}, NumberPoint -> ","], Red], 
     90 Degree]}, {x, 0, 4, 0.2}];
ticksY = Table[{x, Style[NumberForm[x, {2, 1}, NumberPoint -> ","], Red]}, {x,
     0, 4, 0.1}];

grids = {Table[x, {x, 0, 3, 0.1}], Table[x, {x, 0, 3, 0.1}]};

Framed@ParametricPlot[{f[x], g[x]}, {x, 0, 3},
  PlotStyle -> {Thickness[0.003], Black}, 
  AxesLabel -> {Style["n", FontSize -> 12.5, Italic, FontFamily -> "Times"],
    Style["m", FontSize -> 12.5, Italic, FontFamily -> "Times"]},
  AxesOrigin -> {0, 0},
  PlotRange -> All,
  AspectRatio -> Automatic,
  GridLines -> grids,
  Ticks -> {ticksX, ticksY},
  TicksStyle -> Directive[Black, 12.5, FontFamily -> "Times"],
  GridLinesStyle -> {{Gray, Directive[Thickness[0.001]]}, {Gray, 
     Directive[Thickness[0.001]]}},
  AxesStyle -> {{Black, Directive[Thickness[0.002]]}, {Black, 
     Directive[Thickness[0.002]]}},
  ImagePadding -> 30, ImageSize -> 500]
$\endgroup$
1
  • $\begingroup$ That is precisely what I was wondering how to do. Thank You very much. $\endgroup$
    – Bartek
    Jan 10, 2016 at 13:06

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.