ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* tikzplot displacement result
@ 2021-12-12 10:13 Jan-Erik Hägglöf via ntg-context
  2021-12-12 14:53 ` Gavin via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Jan-Erik Hägglöf via ntg-context @ 2021-12-12 10:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jan-Erik Hägglöf

HI!

I’m trying to fit the funktion in the right place in this plot but it seems to get displaced.

What is wrong with the code?

Is there a way to do this in Metafun?

Thanks in advance

Sincerely 

Jan-Erik



\setupbodyfont[10pt]
\enableregime[utf]
\usemodule[tikz]
\usemodule[pgfplots]
\usetikzlibrary[arrows]
\setuppagenumbering[location=]
\starttext
\definecolor[ffvvqq][r=1.,g=0.3333333333333333,b=0.]
\startTEXpage
\starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\startaxis
[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.2488079448294145,
xmax=34.87398305791419,
ymin=-7.496155590728956,
ymax=11.53265632858922,
xtick={-3.0,-2.0,...,34.0},
ytick={-7.0,-6.0,...,11.0},]
\clip(-3.2488079448294145,-7.496155590728956) rectangle (34.87398305791419,11.53265632858922);
\draw[line width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419] plot(\x,{(\x)+3});
\draw[color=ffvvqq] (-3.5583519743388714,-0.7831230981304516) node {$h$};
\stopaxis
\stoptikzpicture
\stopTEXpage
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: tikzplot displacement result
  2021-12-12 10:13 tikzplot displacement result Jan-Erik Hägglöf via ntg-context
@ 2021-12-12 14:53 ` Gavin via ntg-context
  2021-12-14 13:45   ` tikzplot displacement result [solved] Jan-Erik Hägglöf via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Gavin via ntg-context @ 2021-12-12 14:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

Hi Jan-Erik,

Use the \addplot command when you use pgfplots. The manual, pgfplots.pdf, is quite good.

\setupbodyfont[10pt]
\enableregime[utf]
\usemodule[tikz]
\usemodule[pgfplots]
\usetikzlibrary[arrows]
\setuppagenumbering[location=]
\starttext
\definecolor[ffvvqq][r=1.,g=0.3333333333333333,b=0.]
\startTEXpage
\starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\startaxis
[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.2488079448294145,
xmax=34.87398305791419,
ymin=-7.496155590728956,
ymax=11.53265632858922,
xtick={-3.0,-2.0,...,34.0},
ytick={-7.0,-6.0,...,11.0},]
%\clip(-3.2488079448294145,-7.496155590728956) rectangle (34.87398305791419,11.53265632858922);
\addplot[line width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419]{x+3} node[below right, pos= 0.1]{$h$};
\stopaxis
\stoptikzpicture
\stopTEXpage
\stoptext

I removed the clip command because it is causing a problem and is unnecessary. I don’t know what you are trying to do with the node{$h$}, but I made it a label on the plot.

The metafun graph module would also work for this plot, but it pgfplots is more mature. I recommend using pgfplots unless you are already skilled with metapost.

Hope that gets you going in the right direction.

Gavin



> On Dec 12, 2021, at 3:13 AM, Jan-Erik Hägglöf via ntg-context <ntg-context@ntg.nl> wrote:
> 
> HI!
> 
> I’m trying to fit the funktion in the right place in this plot but it seems to get displaced.
> 
> What is wrong with the code?
> 
> Is there a way to do this in Metafun?
> 
> Thanks in advance
> 
> Sincerely 
> 
> Jan-Erik
> 
> 
> 
> \setupbodyfont[10pt]
> \enableregime[utf]
> \usemodule[tikz]
> \usemodule[pgfplots]
> \usetikzlibrary[arrows]
> \setuppagenumbering[location=]
> \starttext
> \definecolor[ffvvqq][r=1.,g=0.3333333333333333,b=0.]
> \startTEXpage
> \starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
> \startaxis
> [
> x=1.0cm,y=1.0cm,
> axis lines=middle,
> ymajorgrids=true,
> xmajorgrids=true,
> xmin=-3.2488079448294145,
> xmax=34.87398305791419,
> ymin=-7.496155590728956,
> ymax=11.53265632858922,
> xtick={-3.0,-2.0,...,34.0},
> ytick={-7.0,-6.0,...,11.0},]
> \clip(-3.2488079448294145,-7.496155590728956) rectangle (34.87398305791419,11.53265632858922);
> \draw[line width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419] plot(\x,{(\x)+3});
> \draw[color=ffvvqq] (-3.5583519743388714,-0.7831230981304516) node {$h$};
> \stopaxis
> \stoptikzpicture
> \stopTEXpage
> \stoptext
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: tikzplot displacement result [solved]
  2021-12-12 14:53 ` Gavin via ntg-context
@ 2021-12-14 13:45   ` Jan-Erik Hägglöf via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Jan-Erik Hägglöf via ntg-context @ 2021-12-14 13:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jan-Erik Hägglöf

HI!

Thank you for your help.

The code was generated by Geogebra Classic 5 "export to pgf/tikz" function and it seems to have errors that needs to be solved in that application.

Now I have a good template to do this on my own.

Regards 

Jan-Erik

> 12 dec. 2021 kl. 15:53 skrev Gavin <gavinpublic@comcast.net>:
> 
> Hi Jan-Erik,
> 
> Use the \addplot command when you use pgfplots. The manual, pgfplots.pdf, is quite good.
> 
> \setupbodyfont[10pt]
> \enableregime[utf]
> \usemodule[tikz]
> \usemodule[pgfplots]
> \usetikzlibrary[arrows]
> \setuppagenumbering[location=]
> \starttext
> \definecolor[ffvvqq][r=1.,g=0.3333333333333333,b=0.]
> \startTEXpage
> \starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
> \startaxis
> [
> x=1.0cm,y=1.0cm,
> axis lines=middle,
> ymajorgrids=true,
> xmajorgrids=true,
> xmin=-3.2488079448294145,
> xmax=34.87398305791419,
> ymin=-7.496155590728956,
> ymax=11.53265632858922,
> xtick={-3.0,-2.0,...,34.0},
> ytick={-7.0,-6.0,...,11.0},]
> %\clip(-3.2488079448294145,-7.496155590728956) rectangle (34.87398305791419,11.53265632858922);
> \addplot[line width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419]{x+3} node[below right, pos= 0.1]{$h$};
> \stopaxis
> \stoptikzpicture
> \stopTEXpage
> \stoptext
> 
> I removed the clip command because it is causing a problem and is unnecessary. I don’t know what you are trying to do with the node{$h$}, but I made it a label on the plot.
> 
> The metafun graph module would also work for this plot, but it pgfplots is more mature. I recommend using pgfplots unless you are already skilled with metapost.
> 
> Hope that gets you going in the right direction.
> 
> Gavin
> 
> 
> 
>> On Dec 12, 2021, at 3:13 AM, Jan-Erik Hägglöf via ntg-context <ntg-context@ntg.nl> wrote:
>> 
>> HI!
>> 
>> I’m trying to fit the funktion in the right place in this plot but it seems to get displaced.
>> 
>> What is wrong with the code?
>> 
>> Is there a way to do this in Metafun?
>> 
>> Thanks in advance
>> 
>> Sincerely 
>> 
>> Jan-Erik
>> 
>> 
>> 
>> \setupbodyfont[10pt]
>> \enableregime[utf]
>> \usemodule[tikz]
>> \usemodule[pgfplots]
>> \usetikzlibrary[arrows]
>> \setuppagenumbering[location=]
>> \starttext
>> \definecolor[ffvvqq][r=1.,g=0.3333333333333333,b=0.]
>> \startTEXpage
>> \starttikzpicture[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
>> \startaxis
>> [
>> x=1.0cm,y=1.0cm,
>> axis lines=middle,
>> ymajorgrids=true,
>> xmajorgrids=true,
>> xmin=-3.2488079448294145,
>> xmax=34.87398305791419,
>> ymin=-7.496155590728956,
>> ymax=11.53265632858922,
>> xtick={-3.0,-2.0,...,34.0},
>> ytick={-7.0,-6.0,...,11.0},]
>> \clip(-3.2488079448294145,-7.496155590728956) rectangle (34.87398305791419,11.53265632858922);
>> \draw[line width=2.pt,color=ffvvqq,smooth,samples=100,domain=-3.2488079448294145:34.87398305791419] plot(\x,{(\x)+3});
>> \draw[color=ffvvqq] (-3.5583519743388714,-0.7831230981304516) node {$h$};
>> \stopaxis
>> \stoptikzpicture
>> \stopTEXpage
>> \stoptext
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________
> 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-14 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 10:13 tikzplot displacement result Jan-Erik Hägglöf via ntg-context
2021-12-12 14:53 ` Gavin via ntg-context
2021-12-14 13:45   ` tikzplot displacement result [solved] Jan-Erik Hägglöf via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).