Axes around image

pic = Import["https://i.imgur.com/QVlIq3g.png"];


Graphics[
 Inset[pic, Scaled[{.5, .5}], Automatic, Scaled[1]],
 Frame -> True,
 PlotRange -> {{1, 15}, {2, 10}},
 AspectRatio -> ImageAspectRatio@pic
]

enter image description here


I wrote you a function for this. It works by explicit setting the option FrameTicks.

ShowImageWithTicks[img_,xRange_,yRange_]:=Module[{dims=ImageDimensions[img]},Show[img,Frame->True,FrameTicks->{{Partition[Riffle[Range[0,dims[[2]],dims[[2]]/(Length[yRange]-1)],yRange],2],None},{Partition[Riffle[Range[0,dims[[1]],dims[[1]]/(Length[xRange]-1)],xRange],2],None}}]]

Which can simply be called with:

img=Import["https://i.imgur.com/QVlIq3g.png"];

ShowImageWithTicks[img,Range[1,15,2],Range[2,10]]

Blockquote

Your Labels can simply be introduced by calling to Show and setting FrameLabel:

Show[ShowImageWithTicks[img,Range[1,15,2],Range[2,10]],FrameLabel->{"time [s]","x [mm]"}]

Blockquote


Assume, im is your image. Try this:

f[x_] := {(600 x)/8 - 150, x}
g[x_] := {(600*x)/(14), x}; 

    Show[im, Frame -> True, FrameTicks -> {{f[#] & /@ Range[2, 10, 2], None},
        {g[#] & /@ Range[2, 14, 2], None}}]

enter image description here

Have fun!

Tags:

Plotting