标签: labels

将颜色条的标签从增加更改为减少值

我想将颜色条的标签从增加更改为减少值.当我尝试通过这样做时vmin,vmax我收到错误消息:

minvalue必须小于或等于maxvalue

所以,例如,我希望颜色栏从左边的20开始,然后在右边的15上.

这是我到目前为止的颜色栏代码,但在这个例子中,值从15到20,我想颠倒这个顺序:

cmap1 = mpl.cm.YlOrBr_r

norm1 = mpl.colors.Normalize(15,20)

cb1   = mpl.colorbar.ColorbarBase(colorbar1, cmap=cmap1, norm=norm1, orientation='horizontal')

cb1.set_label('magnitude')
Run Code Online (Sandbox Code Playgroud)

matplotlib max labels minimum colorbar

6
推荐指数
1
解决办法
3517
查看次数

在metafor中为漏斗图点创建标签

查看漏斗图示例,在metafor页面上 - 似乎有一种方法可以在漏斗图中添加标签.该漏斗图页面提供了更多的细节,但它没有列出添加标签的例子.

提供的示例:

library(metafor)
png(filename="contour_enhanced_funnel_plot.png",
    res=92, width=680, height=600, type="cairo")
par(mar=c(5,4,1,2))
data(dat.bcg)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
           slab=paste(author, year, sep=", "), method="REML")
funnel(res, level=c(90, 95, 99), shade=c("white", "gray", "darkgray"), refline=0)
dev.off()
Run Code Online (Sandbox Code Playgroud)

包含标签字段,但示例中未生成任何标签字段.如何在漏斗图中添加标签?

这里,似乎使用pch可能是另一种选择.有点像:

pch=paste(StudyName, StudyMeasure, sep=", ")
Run Code Online (Sandbox Code Playgroud)

但这只产生一个字母点..

plot r labels

6
推荐指数
1
解决办法
1167
查看次数

matplotlib xtick标签未对齐

我创建了一个非常简单的堆积条形图,但由于某种原因,我的x-tick标签偏离中心.我尝试使用一些tick.label.set_属性来排列它们无济于事.有什么建议?谢谢!

码:

bottom = np.vstack((np.zeros((data.shape[1],), dtype=data.dtype), np.cumsum(data, axis=0) [:-1]))
for dat, col, bot, lab in zip(data, colors, bottom, labels):
    ax1.bar(ind, dat, color=col, bottom = bot, alpha = .7, label = lab)

xticks([z for z in range(0,len(income_brackets))],[(str("{0:.0f}".format(k/1000)) + '-' + str("{0:.0f}".format(l/1000))) for k,l in income_brackets])
for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(12)
    tick.label.set_horizontalalignment('left')
Run Code Online (Sandbox Code Playgroud)

图片:

在此输入图像描述

python matplotlib labels bar-chart

6
推荐指数
1
解决办法
6058
查看次数

如何将表达式(cos(alpha))添加到标签中?

我正试图在箭头上看到一个标签,上面写着:

|| X || cos(alpha)

但我似乎无法使其发挥作用.

我可以||x||毫无问题地编写没有问题的cos(alpha),但我不知道如何将它们写成一个语句.

有任何想法吗?

这是我的代码:

library(plotrix)
library(shape)

xlim <- c(-2, 6)
ylim <- c(-2, 6)
plot(0, type = "n", xlim = xlim, ylim = ylim,asp=1)


Arrows(1,1,5,1)
boxed.labels(3,1,labels="||x|| cos (a)",border=NA,xpad=1,ypad=1)


Arrows(1,2,5,2)
boxed.labels(3,2,labels=expression(cos (alpha)),border=NA,xpad=1,ypad=1)
Run Code Online (Sandbox Code Playgroud)

expression r labels

6
推荐指数
2
解决办法
226
查看次数

Rails 4自定义ActiveAdmin批处理操作集合表单标签

我正在使用Rails 4和ActiveAdmin,这是一个批处理动作集合表单,用于捕获用户执行批处理操作时的输入(在本例中为批处理邮件程序).有没有办法为输入自定义标签?

比如说:

    batch_action :email, priority: 1 , form: {main_subject: :text,
                                              message: :textarea
                                             } do |ids, inputs|
  batch_action_collection.find(ids).each do |user|
   ContactBatchMailer.contact_batch_email(main_subject, message,...


    Instead of having "main_subject", I would like to display a better formatted text, like "Main Subject", or even better, something more descriptive than the variable name by itself. 
Run Code Online (Sandbox Code Playgroud)

我在文档https://github.com/activeadmin/activeadmin/blob/master/docs/9-batch-actions.md#batch-action-forms中进行了挖掘,但我无法做到.任何建议将不胜感激.

forms ruby-on-rails labels batch-processing activeadmin

6
推荐指数
1
解决办法
920
查看次数

可以在没有循环的情况下使用LABEL块吗?

可以在没有循环的情况下使用LABEL块吗?任何例子?

java labels

5
推荐指数
2
解决办法
4476
查看次数

如何在MATLAB中显示米勒指数?

我正在使用MATLAB绘制XRD分析,其中米勒指数用于识别晶面方向.这些索引包含3或4个数字,负数值显示为此数字以上的条形.

在LaTeX中,它可以由\([1\bar{1}1]\)\([1\overline{1}1]\)命令编写.

为了标记XRD标准的光谱线,我使用此命令:请注意,不考虑负值.

std_text_hkl(j)=text(theta{i}(j)-r,0.1,['[' hkl{j} ']'],... % position and label
       of j-th line of i-th standard; hkl{j} holds Miller index in string format
    'parent',ax_std(i),... % association with axes of i-th standard
    'rotation',90,...
    'fontsize',12,...
    'fontname',Font); % Font holds global font setup
Run Code Online (Sandbox Code Playgroud)

如何在不使用'Interpreter','latex'属性的情况下自动创建负数而不是使用属性,因为我希望能够更改'FontName'属性.在leat我想避免标签和刻度中的不同字体.

编辑:
感谢Magla的评论我得到了这个想法:

  • 将索引存储为3列矩阵
  • 将标签分成5个文本字段
  • 如果米勒指数是负的画线(文本框架的顶行)

实际代码:

rr=get(ax_std(i),'xlim'); % read x-axis limits of i-th standard
    r=(rr(2)-rr(1))/150; % x-offset of Miller indexes
    for j=1:size(dhkl,1)
      theta{i}(j)=asin(lambda/(2*dhkl(j,1)))*360/pi(); %calculating of lines
                   %positions (Bragg's law)
      line('parent',ax_std(i),...
            'xdata',[theta{i}(j) …
Run Code Online (Sandbox Code Playgroud)

matlab text latex labels

5
推荐指数
1
解决办法
1360
查看次数

c#流程布局标签卡住了

我有一个带有两个自定义面板的表单,我正在为它们添加一些标签,最后我希望它们从右向左滚动,但它们只是在相同的位置.有我的截图 在此输入图像描述 有两个面板和4个标签,它们只是停留在那里......这是我的表格中的代码:

  private MyPanel topPanel;  // the red bar
  private MyPanel botPanel;  // the white bar

        public SmsBar()
    {
        InitializeComponent();

        this.Width = 500000;

        this.Location = new Point(x, y);

        topPanel = new MyPanel(System.Drawing.Color.White, System.Drawing.Color.Red, (new Font("Tahoma", 10, FontStyle.Bold)));
        botPanel = new MyPanel(System.Drawing.Color.Black, System.Drawing.Color.White, (new Font("Tohama", 10, FontStyle.Regular)));

        msgPanel.Controls.Add(topPanel);
        adPanel.Controls.Add(botPanel);
        botPanel.addMsg(new MsgForDisplay(0, AppData.getInstance().getAdMsg()));
        botPanel.addMsg(new MsgForDisplay(0, AppData.getInstance().getAdMsg2()));

        topPanel.addMsg(new MsgForDisplay(0, "test top"));
        topPanel.addMsg(new MsgForDisplay(0, "test top 2"));

        adPanel.Refresh();
        msgPanel.Refresh();

    }
Run Code Online (Sandbox Code Playgroud)

并且我的自定义面板(构造函数)有一些代码:

  public MyPanel(Color corLabel, Color back, Font text){
    this.color = corLabel;
    this.backg …
Run Code Online (Sandbox Code Playgroud)

c# scroll labels flowlayout

5
推荐指数
1
解决办法
384
查看次数

节点删除的D3更新总是删除SVG DOM中的最后一个条目

我在我的D3应用程序中看到一种奇怪的行为,经过数小时的努力弄清楚发生了什么,我希望有人能指出我明显做错的事情.

我已经将应用程序简化为非常简单并仍然表现出问题.正如你所看到的那样,它源于所有伟大的D3例子.我遇到的一个简单场景是:选择一个节点(通过点击它),并在点击删除键时删除所述节点以及节点和链接的所有相关链接和标签.

下面粘贴的代码几乎就在那里,因为它完全按预期减少了节点和链接的数量(给定任何特定的图形),但有一个问题:节点和链接标签都不正确,最终分布在不同的圆圈上. ..

任何关于可能发生的事情的想法都将不胜感激!

码:

var width = 960,
    height = 700,
    colors = d3.scale.category20();

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

var force = d3.layout.force()
    .gravity(.05)
    .distance(200)
    .charge(-150)
    .size([width, height]);

var jsonnodes, jsonlinks;
var node, link, label;
var selected_node = null,
    mousedown_node = null,
    mousedown_link = null;

d3.json("graph.json", jsondatacallback);


//
// Functions
//

function jsondatacallback(error, json) {
jsonnodes = json.nodes;
jsonlinks = json.links;
force.nodes(jsonnodes)
        .links(jsonlinks);

//
// Nodes
//
node = svg.selectAll(".node")
        .data(jsonnodes);    
node.enter().append("g")
        .attr("class", "node")
        .on('mousedown', …
Run Code Online (Sandbox Code Playgroud)

javascript svg labels d3.js

5
推荐指数
1
解决办法
1674
查看次数

R ggplot:仅将标签应用于绘图中的最后N个数据点

我在R中创建了一个折线图(图表),每个数据点都有标签.由于数据点数量众多,因此标签的图形变得非常完整.我想仅为最后N个(比如4个)数据点应用标签.我已经在geom_label_repel函数中尝试了子集尾部但是无法将它们视为我们或得到错误消息.我的数据集由99个值组成,分布在3组(KPI)上.

我在R中有以下代码:

library(ggplot)
library(ggrepel)

data.trend <- read.csv(file=....)

plot.line <- ggplot(data=data.trend, aes(x = Version, y = Value, group = KPI, color = KPI)) +

  geom_line(aes(group = KPI), size = 1) +
  geom_point(size = 2.5) +


  # Labels defined here
  geom_label_repel(
    aes(Version, Value, fill = factor(KPI), label = sprintf('%0.1f%%', Value)),
    box.padding = unit(0.35, "lines"),
    point.padding = unit(0.4, "lines"),
    segment.color = 'grey50',
    show.legend = FALSE
  )

);
Run Code Online (Sandbox Code Playgroud)

我很公平,我对R很新.也许我想念一些基本的东西.

提前致谢.

r labels ggplot2 datapoint

5
推荐指数
1
解决办法
2682
查看次数