-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a basic smith chart #5615
Add a basic smith chart #5615
Conversation
@waxlamp Thanks for the PR.
then pull & merge |
I marked this PR as "draft" specifically because it's really not ready for review yet. I can still run the syntax fixing and master merge steps if you like, but my plan was to continue working in this "dirty" mode, then at the end clean up the commits and perhaps file them via a new PR branch (closing this one) on which I'd pay much closer attention to the software standards for a ready-to-merge pull request. Let me know how you'd like me to proceed. |
Sounds fine @waxlamp . It might still be nice to see a list of TODOs to break down and understand what's left. Looking forward to discussing tomorrow! |
Completely forgot to address the TODO suggestion from @archmoj, sorry! Yes I will add some TODOs 😸 |
@waxlamp FYI the old image test system is replaced with a new one which would be needed in this PR i.e. to generate new baselines. |
This is just a copy of scatterpolar with a changed name.
This commit also adds a `smith` plot type, which is a copy of polar, with minimal changes needed to host the `scattersmith` trace type.
Also cleaned up code a little bit.
Thanks for the guidance--I just did this, so we should be able to discuss later today. Looking forward to it! |
@waxlamp would you please fetch upstream master and merge (or rebase). |
Please add one of the
|
var real = layoutOut.smith.realaxis; | ||
|
||
expect(imag.type).toBe('linear'); | ||
expect(real.type).toBe('linear'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type
should be expected to be undefined for these axes not linear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, the axis types really are linear
. It may be an implementation detail, in which case I can simply remove these assertions from the test.
expect(imag.type).toBe('linear'); | ||
expect(real.type).toBe('linear'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's copy & adapt these test from polar_test
:
it('should propagate axis *color* settings', function() {
it('should coerce hoverformat even for `visible: false` axes', function() {
it('should be able to reorder axis layers when relayout\'ing *layer*', function(done) {
it('should be able to toggle axis features', function(done) {
it('should clean up its framework, clip paths and info layers when getting deleted', function(done) {
it('should trigger hover/unhover/click/doubleclick events', function(done) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See c1613b2.
gridwidth: axesAttrs.gridwidth | ||
}, 'plot', 'from-root'); | ||
|
||
var axisTickAttrs = overrideAll({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these may not be supported.
Let's test all the working features in the image test.
connectgaps: scatterAttrs.connectgaps, | ||
|
||
marker: scatterAttrs.marker, | ||
cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, {dflt: false}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test cliponaxis: true
in the image test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For smith charts, there's not much meaning in plotting values outside the main plot area--that is, cliponaxis
should always be true
and this shouldn't be an attribute in the trace. Can I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cliponaxis
is more subtle than that - it's about what happens when a marker gets close to the subplot boundary: do we draw it partially, literally clipping the drawn shape to the subplot area, or do we continue drawing the complete shape until the data point itself exits the subplot area? See https://rreusser.github.io/plotly-mock-viewer/#cliponaxis_false
smoothing: lineAttrs.smoothing, | ||
editType: 'calc' | ||
}, | ||
connectgaps: scatterAttrs.connectgaps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connectgaps
is working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Added a test in aa13b91.
textposition: scatterAttrs.textposition, | ||
textfont: scatterAttrs.textfont, | ||
|
||
fill: extendFlat({}, scatterAttrs.fill, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have tests for fill
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but my understanding is that fill doesn't really make sense in a smith chart. Should I keep it and write a test, or remove the attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonetheless, it does seem to work, and I added a test: 383b6f1
|
||
text: scatterAttrs.text, | ||
texttemplate: texttemplateAttrs({editType: 'plot'}, { | ||
keys: ['re', 'im', 'text'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for these texttemplate
options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
|
Thanks for the contribution on this PR. |
This draft PR shows a WIP approach to adding a Smith chart to Plotly. This consists of a new
scattersmith
trace and a newsmith
chart type that work together.scattersmith
andsmith
are copies ofscatterpolar
andpolar
that I have slowly mutated in place to implement Smith chart semantics.TODOs:
scattersmith
configradialaxis
andangularaxis
torealaxis
andimaginaryaxis
respectively