Creating a plot in dealii

51 views
Skip to first unread message

Wasim Niyaz Munshi ce21d400

unread,
Feb 11, 2023, 9:27:06 AM2/11/23
to deal.II User Group
Hello everyone. I have 2 Vector<double> vectors A and B of the same size,n. I want to plot A vs B (A along x and B along y). I was trying something like this:
 DataOut<1,Vector<double> > data_out;
  data_out.add_data_vector (A, "A");
  data_out.add_data_vector (B, "B");

  // Write the Gnuplot file
  data_out.build_patches ();
  data_out.write_gnuplot (deallog.get_file_stream());
 but it gives these errors:
error: type/value mismatch at argument 2 in template parameter list for ‘template<int dim, int spacedim> class dealii::DataOut’
 expected a constant of type ‘int’, got ‘dealii::Vector<double>’


Bruno Turcksin

unread,
Feb 13, 2023, 8:52:02 AM2/13/23
to deal.II User Group
Hello,

DataOut is made to add data to a mesh. It cannot be used to do what you want. The easiest way to do what you want is to write the vectors to a file using print() and then do the plot using matlab or python.

Best,

Bruno

Wasim Niyaz Munshi ce21d400

unread,
Feb 14, 2023, 10:12:02 AM2/14/23
to dea...@googlegroups.com
Thank you very much. It was indeed the easiest way to do it.

Regards 

Wasim Niyaz
Research scholar
CE Dept.
IITM

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/CJH-Z37kLco/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3a96404f-f7fc-4aa2-83e9-0f35cf8889f6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages