Skip to content
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

Value legend #565

Merged
merged 10 commits into from
Feb 12, 2016
Merged

Value legend #565

merged 10 commits into from
Feb 12, 2016

Conversation

Seanny123
Copy link
Collaborator

Added labels to the value plot and the ability to edit them. This is an intermediary step to allowing the basal-ganglia to have it's own specialised plot.

@Seanny123
Copy link
Collaborator Author

The modal dialogue for changing the labels does not work as expected.

// fill up an array with temporary labels
for(i=0; i<this.n_lines; i++){
if(this.legend_labels[i] === undefined){
this.legend_labels[i] = "label_".concat(String(i));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick style question: is there a preference to do "label_".concat(String(i)) rather than "label_" + i? I find the latter clearer, but it's just what I'm used to.

@Seanny123
Copy link
Collaborator Author

Current status:

  • Labels don't seem to be reloaded on refresh.

this.div.appendChild(this.legend);

this.legend_labels = args.legend_labels || [];
console.log(this.legend_labels);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraneous console.log

@tcstewar
Copy link
Collaborator

tcstewar commented Feb 6, 2016

Looking good... one small issue: If you open up the plot with N dimensions, show the legend, and then change the number of dimensions to N-1, it doesn't eliminate that from the legend.

if (this.legend_labels.length !== this.n_lines) {
// fill up the array with temporary labels
for (var i=this.legend_labels.length; i<this.n_lines; i++) {
this.legend_labels[i] = "label_" + i;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the defaults be "0, 1, 2, ..." rather than "label_0, label_1, label_2, ..."?

@Seanny123
Copy link
Collaborator Author

The changing dimensions problem should be fixed now.

@tcstewar
Copy link
Collaborator

tcstewar commented Feb 8, 2016

The changing dimensions problem should be fixed now.

Nice, that seems to work... but here's another bug for you. :)

  • Start with this basic network:
import nengo

model = nengo.Network()
with model:
    stim = nengo.Node([0])
    a = nengo.Ensemble(n_neurons=50, dimensions=1)
    nengo.Connection(stim, a[0])
  • make a value plot for a
  • show the legend
  • set dimensions to 5
  • hide the legend
  • set dimensions back to 1
  • show the legend again

When the legend re-appears, it will have 5 items on it, rather than 1.

@Seanny123
Copy link
Collaborator Author

@tcstewar fixed the bug (:

@tcstewar
Copy link
Collaborator

Looks good to me! Thanks for all the work on this!

tcstewar added a commit that referenced this pull request Feb 12, 2016
@tcstewar tcstewar merged commit ab682de into master Feb 12, 2016
@tcstewar tcstewar deleted the value-legend branch February 12, 2016 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants