Comments (4)
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.
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.
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.
many TODOs resulting from this, will create separate issues....
from trase.
Related Issues (20)
- compile trase with emscripten
- create a nice template example
- Potential new colourmap
- provide functionality to static_cast vectors of differing types HOT 1
- create separate repository for generated files
- more examples
- Histogram example - Error in debug mode HOT 1
- rectangle geometry
- rectangle example not filling with correct colors
- all geometries are not commented
- windows build failing due to double -> float conversions
- Mock backend classes for tests
- add contributing.md
- subplot and animation facets HOT 1
- new base backend class: InteractiveBackend
- Can I draw three-dimensional coordinates? HOT 1
- GitHub actions HOT 7
- Choosing colors HOT 9
- examples that need curl not being compiled
- ylabel overlaps with the yticks HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trase.