I want to plot some data and for one of them I want to show (0.1,Inf), where Inf stands for infinity. Also, I want yaxis to be in log-scale. I have attached a sample photo of what I want to plot.

enter image description here

Does anyone know how I can do this? Thank you in advance for your help.

  • With pstricks, it is very simple: an optional argument of the command \psaxes sets the labels for the axes. – Bernard Dec 30 '19 at 22:31

Welcome! Sure, you can do that. Here is an example.

 \begin{axis}[declare function={myinf=10^6;},ymode=log,
  \addplot[mark=star,thick] coordinates {(0.1,myinf) (0.3,myinf) (0.5,10^3)};
  \addplot[color=red,mark=o] coordinates {(0.1,10^4.5) (0.3,10^4.1) (0.5,10^4)};

enter image description here

The functions Inf and inf are already taken, so I call the function myinf. Yet this example shows how you can get any symbolic value in the TikZ-pgfplots ecosystem: just declare a function. This can then be used in plots. Changing the ticks is a very standard task in pgfplots.

If you post a code of a use case, there will be a much more automatic solution possible, but at this point I have no idea what you are up to.

  • thank you so much – user204090 Dec 31 '19 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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