Graphics, Figures & TablesPlotting an array of numbers using Tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Plotting an array of numbers using Tikz

Post by jhapk »

I have an array of numbers, ZX, as follows of size N=12.
  • -1.0000000000000000
    -0.94489927222288217
    -0.81927932164400663
    -0.63287615303186073
    -0.39953094096534891
    -0.13655293285492756
    0.13655293285492756
    0.39953094096534891
    0.63287615303186073
    0.81927932164400663
    0.94489927222288217
    1.0000000000000000
Depending on N, these values of ZX change. ZX always remain in the range (-1,1). I want to make a square with corners at (-1,-1) to (1,1) and have lines inserted based on the values of ZX as shown in the following figure (in this case N=5):
collocation points.png
collocation points.png (12.98 KiB) Viewed 4473 times
I don't know how can I use the values of an array to plot lines in Tikzpicture. Can someone help me here?
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Plotting an array of numbers using Tikz

Post by Stefan Kottwitz »

Hi,

such a drawing is not very hard. I think automating could be a challenge, or reading from a file, but for a certain N and a list of ZX values in the code it should be easy.

How far did you come? Do you have some code for a start? Where is the problem - loop, thick point, lines, ... ? We gladly help but it's easier if you would provide a starting point.

Stefan
LaTeX.org admin
Post Reply