Graphics, Figures & TablesData visualization

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

Data visualization

Post by topsquark »

Here's a dipolar field plot I just made. I'm graphing from data files so I've attached the image to show you my questions. Just to be clear, I'm reasonably satisfied with this, but I have two questions I'd like to ask.
1) Can decorations be added to the plot? I had to put in the arrows myself (and as you can see it's a bit off.) I doubt you can but I thought I'd ask.

2) Can you change the color of the text? The arrows should be red but I can't figure out how to change that using pgf. I'm including the code but, obviously, it won't work without the data files.

Thanks!

-Dan
Dipole Field.jpg
Dipole Field.jpg (343.62 KiB) Viewed 2859 times

Code: Select all

\begin{tikzpicture}
      \clip (0,11.3) rectangle (11,16.7);
% Graph
     \datavisualization[scale=3,scientific axes,x axis={length=4cm},y axis={length=9.33cm},visualize as smooth line/.list={
          field1,field3,field5,field6,field7,field8,field9,field10,
          equipot1,equipot2,equipot3,equipot4,equipot5,
          equipot6,equipot7,equipot8,equipot9,equipot10},
          field1={style={red}},
          field3={style={red}},
          field5={style={red}},
          field6={style={red}},
          field7={style={red}},
          field8={style={red}},
          field9={style={red}},
          field10={style={red}},
          equipot1={style={blue}},
          equipot2={style={blue}},
          equipot3={style={blue}},
          equipot4={style={blue}},
          equipot5={style={blue}},
          equipot6={style={blue}},
          equipot7={style={blue}},
          equipot8={style={blue}},
          equipot9={style={blue}},
          equipot10={style={blue}},
          ]
          data[set=field1,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata1.csv]
          data[set=field3,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata3.csv]
          data[set=field5,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata5.csv]
          data[set=field6,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata6.csv]
          data[set=field7,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata7.csv]
          data[set=field8,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata8.csv]
          data[set=field9,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata9.csv]
          data[set=field10,headline={x,y},read from file=C:/users/topsq/Desktop/efielddata10.csv]
          data[set=equipot1,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata1.csv]
          data[set=equipot2,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata2.csv]
          data[set=equipot3,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata3.csv]
          data[set=equipot4,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata4.csv]
          data[set=equipot5,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata5.csv]
          data[set=equipot6,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata6.csv]
          data[set=equipot7,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata7.csv]
          data[set=equipot8,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata8.csv]
          data[set=equipot9,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata9.csv]
          data[set=equipot10,headline={x,y},read from file=C:/users/topsq/Desktop/equipotdata10.csv]
          ;
% Arrows
          \pgftext[base,x=6.02cm,y=16.48cm] {>};
          \pgftext[base,x=6.02cm,y=15.77cm] {>};
          \pgftext[base,x=6.02cm,y=14.7cm] {>};
          \pgftext[base,x=6.02cm,y=13.9cm] {>};
          \pgftext[base,x=6.02cm,y=13.1cm] {>};
          \pgftext[base,x=6.02cm,y=12.07cm] {>};
          \pgftext[base,x=6.02cm,y=11.34cm] {>};
          \pgftext[base,x=4.11cm,y=11.7cm,rotate=-55] {>};
          \pgftext[base,x=4.19cm,y=16.1cm,rotate=55] {>};
          \pgftext[base,x=7.9cm,y=11.7cm,rotate=55] {>};
          \pgftext[base,x=7.81cm,y=16.1cm,rotate=-55] {>};
          \pgftext[base,x=3.32cm,y=11.7cm,rotate=-90] {>};
          \pgftext[base,x=3.49cm,y=16.1cm,rotate=90] {>};
          \pgftext[base,x=8.68cm,y=11.7cm,rotate=90] {>};
          \pgftext[base,x=8.51cm,y=16.1cm,rotate=-90] {>};
          \pgftext[base,x=2.55cm,y=11.7cm,rotate=-100] {>};
          \pgftext[base,x=2.79cm,y=16.1cm,rotate=100] {>};
          \pgftext[base,x=9.44cm,y=11.7cm,rotate=100] {>};
          \pgftext[base,x=9.2cm,y=16.1cm,rotate=-100] {>};
          \pgftext[base,x=1.56cm,y=11.7cm,rotate=-115] {>};
          \pgftext[base,x=1.92cm,y=16.1cm,rotate=115] {>};
          \pgftext[base,x=10.42cm,y=11.7cm,rotate=115] {>};
          \pgftext[base,x=10.05cm,y=16.1cm,rotate=-118] {>};
% Charges
     \filldraw (3.8cm,14cm) circle (0.1cm);
     \fill (8.23cm,14cm) circle (0.1cm);
\end{tikzpicture}

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply