# How can i make an empty graph without using csv?

**URL:** <https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814>\
**Category:** Libraries\
**Created:** [February 3, 2023, 10:26am UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814 "2023-02-03T10:26:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadimkuzmin](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Post date:** [February 3, 2023, 10:26am UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/1 "2023-02-03T10:26:04Z")

</div>

Good afternoon, I found an example that I would like to edit to fit my values at the moment I can use the graph from the file csv, but how can you do the same with processing tools?

 ![grafik6](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/1/11967cdabd219bd53444ac8ddda844f7b5532692.png)

```auto
import grafica.*;
 
GPlot plot1, plot2;
 
void setup() {
  size(440, 420);
 
  // Create the first plot
  plot1 = new GPlot(this);
  plot1.setPos(0, 0);
  plot1.setMar(60, 70, 40, 70);
  plot1.setDim(300, 300);
  plot1.setAxesOffset(4);
  plot1.setTicksLength(4);
 
  // Create the second plot with the same dimensions
  plot2 = new GPlot(this);
  plot2.setPos(plot1.getPos());
  plot2.setMar(plot1.getMar());
  plot2.setDim(plot1.getDim());
  plot2.setAxesOffset(4);
  plot2.setTicksLength(4);
 
  // Prepare the points
  int nPoints = 50;
  GPointsArray points = new GPointsArray(nPoints);
 
  for (int i = 0; i < nPoints; i++) {
    points.add(i, 30 + 10*noise(i*0.1));
  }  
 
  // Set the points, the title and the axis labels
  plot1.setPoints(points);
  plot1.setTitleText("Temperature");
  plot1.getYAxis().setAxisLabelText("T (Celsius)");
  plot1.getXAxis().setAxisLabelText("Time (minutes)");
 
  plot2.getRightAxis().setAxisLabelText("T (Kelvin)");
 
  // Make the right axis of the second plot visible
  plot2.getRightAxis().setDrawTickLabels(true);
 
  // Activate the panning (only for the first plot)
  plot1.activatePanning();
}
 
void draw() {
  background(255);
 
  // Draw the first plot
  plot1.beginDraw();
  plot1.drawBox();
  plot1.drawXAxis();
  plot1.drawYAxis();
  plot1.drawTitle();
  plot1.drawPoints();
  plot1.drawLines();
  plot1.endDraw();
 
  // Change the second plot vertical scale from Celsius to Kelvin
  plot2.setYLim(celsiusToKelvin(plot1.getYLim()));
 
  // Draw only the right axis
  plot2.beginDraw();
  plot2.drawRightAxis();
  plot2.endDraw();
}
 
//
// Transforms from degree Celsius to degree Kelvin
//
float[] celsiusToKelvin(float[] celsius){
  float[] kelvin = new float[celsius.length];
 
  for(int i = 0; i < celsius.length; i++){
    kelvin[i] = 273.15 + celsius[i];
  }
 
  return kelvin;
}

```

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [February 3, 2023, 1:02pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/2 "2023-02-03T13:02:17Z")

</div>

Hi

Some informations here

> [@Use Processing to make continuous graph using CSV](https://discourse.processing.org/t/use-processing-to-make-continuous-graph-using-csv/16898/4):
>
> a GRAPH / PLOT as a short window of data from ONE CSV file? or a graph of all data from CSV with a zoom function? possibly better use a library ( loaded via PDE contribution manager ) like [https://jagracar.com/grafica.php](https://jagracar.com/grafica.php) still i think you should start with your own little plot function -1- point(x,y) -2- rect() -3- a line connecting the measuring points and ignore the axis / grid beauty things at first next need check data in a first loop for min max to auto adjust graph float dmi…

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 3, 2023, 2:00pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/3 "2023-02-03T14:00:25Z")

</div>

> [@Vadimkuzmin](#):
>
> at the moment I can use the graph from the file csv, but how can you do the same with processing tools?

I am not sure I understand.

Do you mean to change the csv and leave the program it is?

- You can edit the csv and insert your own data.
- You can use a Text Editor (notepad in windows) to edit csv.
- You can use Excel to edit it, but it’s tricky, and I think you need to use import / export to get good results.
- Just make a copy from the old csv and copy new csv into it.
- Of course you can make a simple Excel clone to edit existing csv. But why.

OR do you mean to change the program?

---

<div class="post-metadata">

**Author:** ![Vadimkuzmin](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Post date:** [February 3, 2023, 2:14pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/4 "2023-02-03T14:14:12Z")

</div>

Yes! I mean change the code of the program like in the picture without using the csv file at all!

How to change the left column with data from 150 in steps of 5 to 300.  
How to change the data at the bottom from 1 to 99 in increments of 1. How to change the right column from 200-299?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 3, 2023, 2:26pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/5 "2023-02-03T14:26:46Z")

</div>

I don’t think there is a csv file used in the program above.

The points are generated with noise().

- Do you want to use a csv? Then look at `loadStrings()` in the reference, for loop over the array and use ` points.add( ... )`.

- When you don’t want to use a csv and don’t want to load a csv, you can just write the data into your Sketch and parse them to ` points.add(....)`.

for example

```auto

float[][] listData = 
   {
     {112,23}, 
     {212,13}, 
     {172,17}
   };

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 3, 2023, 2:38pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/6 "2023-02-03T14:38:13Z")

</div>

> [@Vadimkuzmin](#):
>
> How to change the left column with data from 150 in steps of 5 to 300.  
> How to change the data at the bottom from 1 to 99 in increments of 1. How to change the right column from 200-299?

Now we are talking.

Look at this

```auto
 for (int i = 0; i < nPoints; i++) {
    points.add(i, 30 + 10*noise(i*0.1));
  }  

```

Consider

```auto
 for (int i = 1; i < 99; i+=1) {
    points.add(i, i*5 );
  }  

```

---

<div class="post-metadata">

**Author:** ![Vadimkuzmin](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Post date:** [February 3, 2023, 4:09pm UTC](https://discourse.processing.org/t/how-can-i-make-an-empty-graph-without-using-csv/40814/7 "2023-02-03T16:09:52Z")

</div>

Very good thanks for the tip from I something went out.  
I think the right side is the same.
