[pstricks] Can I get a x-coordinate from a point anyhow?

Herbert Voss LaTeX at zedat.fu-berlin.de
Wed Aug 16 07:18:06 CEST 2006


Martin Sievers wrote:

> I ask for your help for the following problem: I want to plot two
> function f,g on [xmin,xmax] which have an intersection point S=(s1,s2).
> The tricky thing about it is, that I want to plot the functions
> differently on [xmin,s1] and [s1,xmax], for example red and blue.
> As I only know S, but not the coordinates s1 and s2 themselves, I wonder
> how I can achieve that.

it's possible, but only on PS side

Herbert

\documentclass{scrbook}
\usepackage[ngerman]{babel}
\usepackage[latin9]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[prologue,dvipsnames,showerrors]{pstricks}
\usepackage{pst-plot}
\usepackage{pst-node}
\usepackage{pst-eucl}
\usepackage{pstricks-add}

\makeatletter
\def\getXfromNode#1{%
   tx at NodeDict begin /N@#1 load GetCenter end
   pop \pst at number\psxunit div }
\makeatother

\begin{document}

\begin{pspicture}(0,0)(12,8)
\psset{algebraic,comma,llx=-0.75cm,lly=-0.75cm,urx=0.75cm,Dy=5,Dx=1,labelFontSize={\footnotesize},xAxisLabel={$t$},yAxisLabel={$p$}}
\begin{psgraph}{->}(0.0,0)(7.25,27){10.50cm}{7.25cm}
\pstInterFF{25 Euler x neg 0.25 mul exp mul}{10 Euler x neg 0.1 mul exp
mul}{6}{S}
\psplot[plotpoints=200]{0}{\getXfromNode{S}}{25*Euler^(-0.25*x)}
\psplot[plotpoints=200]{0}{\getXfromNode{S}}{10*Euler^(-0.1*x)}
\psplot[plotpoints=200,linestyle=dashed]{\getXfromNode{S}}{7}{25*Euler^(-0.25*x)}
\psplot[plotpoints=200,linestyle=dashed]{\getXfromNode{S}}{7}{10*Euler^((0.25-0.1)*x)}
\end{psgraph}
\end{pspicture}

\end{document}





More information about the PSTricks mailing list