Giter VIP home page Giter VIP logo

Comments (4)

martinjrobins avatar martinjrobins commented on August 22, 2024

I do like the idea of separating the data from the means of displaying it. At the moment we have the data copied into the plot1d class, you could imagine that you wanted two side by side plots of the same data set, so its a bit wasteful to have two copies of the data.

from trase.

martinjrobins avatar martinjrobins commented on August 22, 2024

The idea of the gog is that any plot is composed of these elementary parts:

  • data and aesthetic mapping,
  • a statistical transformation (stat),
  • a geometric object (geom), and
  • a position adjustment.

Translating the first three into classes:

class Data {
 // raw data set, can have any number of columns
 std::vector<std::vector<float>> data_matrix; 
};
class Aesthetic {
  int x; // column index for the x-axis
  int y;  // column index for the y-axis
  int colour; // column index to colour by
};
class Stat {
  std::shared_ptr<Data> original_data;
  Data transformed_data;
  Stat(Data *original_data) {
     // transform could be a histogram, for example
     transformed_data = transform(original_data); 
  }
};
enum Geom  = {Point, Line, Box, ...};
};

So each Plot1d could contain this set of elements

class Plot1d {
    // the Stat contains the original and transformed data
    // need a vector since we'll have one dataset for each frame
   std::vector<std::shared_ptr<Stat>> m_data;
   Aesthetic m_aes; // which columns to plot
   Geom m_geom; // how to plot them
   ...
};

@fcooper8472, what do you think about this layout?

from trase.

martinjrobins avatar martinjrobins commented on August 22, 2024

We've decided to implement this layout as is for the moment and see how it works.
Things to think about:

  • user-facing API for sharing data/stats between plots
  • 2d histograms: will it be slow drawing many squares for a 2d histogram versus drawing an image? Best to try it and find out
  • Should Stat simply have an enum that swaps between transforms, or have derived classes implement each transform (going with an enum for now)
  • Other aesthetics, e.g. opacity, size etc.

from trase.

martinjrobins avatar martinjrobins commented on August 22, 2024

many TODOs resulting from this, will create separate issues....

from trase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.