Comments (3)
I agree that when using the update_component
method, your syntax feels more intuitive. There are a couple of tricky things though. The first is that update_component
is the building block for __iadd__
,__add__
,__isub__
, and __sub__
, which is supposed to be the user-facing API for Vincent, where the examples above read
>>>my_vega += ('w', 'axes', 0, 'scale')
>>>my_vega -= ('width', 'marks', 0, 'properties', 'enter')
In my brain that reads add w to (axes, 0, scale)
and remove width from (marks, 0, properties, enter)
, which feels straightforward and I think works pretty well in practice.
The second is that update_component
is doing a recursive dive into the tree via passed arguments, and by leaving the args to the end we don't have to introduce more control flow to catch an "add" or "remove" as it traverses the vega spec.
I'm very hesitant to make a major API change like this, but I'm open for discussion if any of the other Vega contributors and users have thoughts.
from vincent.
Hi @wrobstory, thanks for your comments. As a Vincent newbie, i appreciate the explanation.
To my mind, the following calls are more intuitive
>>>my_vega += ('axes', 0, 'scale', 'w')
>>>my_vega -= ('marks', 0, 'properties', 'enter', 'width')
because they list from left to right the path through the Vega spec tree to the desired change.
But, like i said, i'm a Vincent newbie and so defer to you and other long-time Vincent users on this point. Maybe through using Vincent more, i'll adapt and eventually find the current syntax natural.
from vincent.
Heh- Vincent is new enough that there are no long time Vincent users yet! Your input is appreciated, because we're still early enough in it's life that we can think about syntax changes like this. If you're motivated, you could fork the project and create an implementation of the syntax you are suggesting. The Vincent source code is a quick read, and pretty friendly to tinkering.
Also, go take a look at Issue #31 - we're probably going to be moving towards a more friendly ORM-style implementation of chart creation, and leave things like update_component
for power users in the future.
from vincent.
Related Issues (20)
- Where does y2 field come from in stacked bar example
- Creating Gradient Legend with LegendProperties HOT 3
- does vincent support log scale? HOT 3
- Spacing Issue with X and y Axis
- Regression with 0.1.5 using vincent line chart
- Vincent off-by-one datetime axis bug after Monthly resampling
- Building an internal map of my house
- Need polygon lat long for Alaska, Hawaii, Guam and Puerto Rico
- Update readthedocs
- Python Bubble Maps with Different Coloring for U.S. Regions (Midwest, Southeast,...)
- zip code based heat map with vincent?
- Exporting map HOT 1
- Grouped and Stacked Bar chart
- Is there any way to update Vincent JSON plot without redrawing it?
- Some States missing from Maps
- No way to enable the grid lines
- Anything similar to "Alpha"
- How can I draw a historical map?
- How vincent can b used with the Django framework?
- Dependency Wheel/Circos Plot
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 vincent.