2
$\begingroup$

I'm trying to represent the projection of a point on the axes of a plot.

plot1 = ResourceFunction["CombinePlots"][ Plot[{x^2, Line[{{5, 0}, {5, 10}}]}, {x, 0, 10}, Frame -> True, PlotRange -> {0, 100}, FrameStyle -> {{Blue, Red}, {Black, Black}}, BaseStyle -> 15], Plot[100 x^4, {x, 0, 10}, ScalingFunctions -> "Log", Frame -> True, PlotRange -> {0, 10^6}, FrameStyle -> Red, PlotStyle -> Red], "AxesSides" -> "TwoY"] annotation[x_, y0_, y1_, txt_] := With[{dy = .33}, {Dashed, Gray, Line[{{x, y0}, {x, y1}}], Text[txt, {x, y0 - dy}]}] poi = {{5, "t1"}}; plot2 = Show[plot1, FrameLabel -> {"a", "b", "", "c"}, PlotLabel -> "title", Epilog -> {{(annotation[#[[1]], -8.0,25, #[[2]]] & /@ poi)} }] 

The use of labels is due to the fact that the graphic is meant to be used with LaTeX. In this mwe, the point is being indicated with explicit reference to the function; in my applications it's actually necessary to specify it in this way. The desired output is something like this:

enter image description here

and then:

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ add the option PlotRangeClipping -> False in Show? $\endgroup$ Commented Jul 22, 2021 at 13:40

1 Answer 1

5
$\begingroup$
rf = ResourceFunction["CombinePlots"]; Quiet @ rf[Plot[x^2, {x, 0, 10}, Frame -> True, PlotRange -> {0, 100}, FrameStyle -> {{Blue, Red}, {Black, Black}}, BaseStyle -> 15], Plot[100 x^4, {x, 0, 10}, ScalingFunctions -> "Log", Frame -> True, PlotRange -> {0, 10^6}, FrameStyle -> Red, PlotStyle -> Red], "AxesSides" -> "TwoY", FrameLabel -> {"a", "b", "", "c"}, PlotLabel -> "title", PlotRangeClipping -> False, Epilog -> {Dashed, Gray, Line[{{0, 25}, {5, 25}, {5, 0}}], Text[Style[Subscript[t, 1], 12], {5, 0}, {Center, Top}], Text[Style[f[Subscript[t, 1]], 12], Offset[{-15, 7}, {0, 25}], {Right, Center}]}] 

enter image description here

$Version 
11.3.0 for Microsoft Windows (64-bit) (March 7, 2018) 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.