有没有一种简单的方法可以在图表上的圆圈中添加文字标签?我无法使用directlabels包,因为我收到错误:
direct.label.ggplot(p,"first.qp")出错:需要颜色审美来推断默认的直接标签."
这是图表:

这是我一直在使用的代码:
library(ggplot2)
library(directlabels)
#my data set:
oc <- read.csv("http://www.columbia.edu/~mad2200/oc.csv")
oc$percent_women <- oc$W_employment/(oc$M_employment+oc$W_employment)
oc$size <- oc$W_employment+oc$M_employment
p <- ggplot(oc, aes(M_w_earnings, W_w_earnings, label = as.character(Occupational.Group)))
p + geom_point(aes(size = size, colour=percent_women)) + scale_size_continuous(range=c(0,30)) + #scale_area()+
#geom_point(aes(colour = oc$percent_women)) +
coord_equal() +
scale_colour_gradient(high = "red")+
ylim(700, 1700) +
xlim(700, 1700) +
geom_abline(slope=1) +
labs(title = "Income Disparity by Occupation and Gender") +
ylab("Women's Weekly Earnings in $") +
xlab("Men's Weekly Earnings in $")
Run Code Online (Sandbox Code Playgroud) 我有一堆Stata .dta文件,我想在R中使用.
我的问题是变量名对我没有帮助,因为它们就像"q0100","q0565","q0500"和"q0202".然而,它们被标记为"psu","怀孕的数量","户主"和"航点".
我希望能够抓住标签("psu","航点"等等),并将它们用作我的变量/列名称,因为这些更容易让我使用.
有没有办法做到这一点,最好是在R中,还是通过Stata本身?我知道库(外国)中的read.dta,但不知道它是否可以将标签转换为变量名.
我的图表上的标签显示在工具提示上,看起来不太好.我试着玩zIndex,但没有结果.如何使工具提示不透明?这是我的jsFiddle:http://www.jsfiddle.net/4scfH/3/
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'graf1',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
margin: 40,
text: 'Podíl všech pot?eb'
},
tooltip: {
//pointFormat: '<b>{point.y} K? [{point.percentage}%]</b>',
percentageDecimals: 2,
backgroundColor: "rgba(255,255,255,1)",
formatter: function() {
return this.point.name + '<br />' + '<b>' + Highcharts.numberFormat(this.y).replace(",", " ") + ' K? [' + Highcharts.numberFormat(this.percentage, 2) + '%]</b>';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: …Run Code Online (Sandbox Code Playgroud)我有几千点的散点图.这篇文章告诉我如何标记它们:
但这看起来像是一场有如此多点的灾难.我想要的是有一个"工具提示"类型标签,当你鼠标悬停一个点时弹出.这可能使用matplotlib吗?
它无法编译源代码和写入:
架构i386的未定义符号:
"_ CTFontManagerRegisterFontsForURL",引用自: - CCLabelTTF中的[CCLabelTTF getFontName:] ld:未找到架构i386的符号clang:错误:链接器命令失败,退出代码为1(使用-v为看调用)
但是当我用"return nil"替换CCLabelTTF中以下函数中的所有代码时:
- (NSString*) getFontName:(NSString*)fontName
{
// Custom .ttf file ?
if ([[fontName lowercaseString] hasSuffix:@".ttf"])
{
// This is a file, register font with font manager
NSString* fontFile = [[CCFileUtils sharedFileUtils] fullPathForFilename:fontName];
NSURL* fontURL = [NSURL fileURLWithPath:fontFile];
CTFontManagerRegisterFontsForURL((CFURLRef)fontURL, kCTFontManagerScopeProcess, NULL);
return [[fontFile lastPathComponent] stringByDeletingPathExtension];
}
return fontName;
}
Run Code Online (Sandbox Code Playgroud)
然后我可以编译我的代码,但我不能使用标签.
那么如何在不创建新项目的情况下解决这个问题并将所有资源复制到其中呢?
EDITED
以前的版本是2.x,现在我有最后一个rc2版本.
我删除了旧库的所有文件,将文件从新库复制到项目文件夹中,并通过xcode将它们添加到项目中.xcode可以用新的库文件创建项目,所以我从这个新项目中获取它们.然后我做了一些更改以删除警告.
请原谅我可能非常愚蠢的问题,但我的好奇心正在扼杀我,而且我是新手,但是你在标记中使用了重要的标签,为什么?
即
<label for="birthdate">Birthdate:</label>
<input type="text" id="birthdate" name="birthdate" />
Run Code Online (Sandbox Code Playgroud)
为什么我必须标记这个输入,为什么它对用户有益,为什么对将来的使用有益,或者它是搜索引擎优化的东西.这就是我真正想知道的:)
我一直以为标签必须只用于循环,但似乎不是.给这样的代码:
public class LabelTest {
public static void main(String[] args) {
label1: System.out.println("");
label2: LabelTest t = new LabelTest();
}
}
Run Code Online (Sandbox Code Playgroud)
当标记为"label1"的编译行编译时,"label2"处的代码会出错.为什么?为什么我要标记不是"循环"的语句?
勾选大于约10'000的刻度标签,例如格式化为1x10 ^ 4.而指数部分出现在相应的轴上方.这种不当行为在matlab中心也有很好的描述,但没有解决方案.
谢谢你的帮助.
'快速技巧'
set(gca, 'YTickLabel',get(gca,'YTick'))
Run Code Online (Sandbox Code Playgroud)
应用于bar3时无效,如下图所示.

我不想将单词或数字作为x轴的刻度标签,而是绘制一个简单的绘图(由直线和圆圈组成)作为每个x刻度的标签.这可能吗?如果是这样,在matplotlib中最好的方法是什么?
labels ×10
matplotlib ×2
plot ×2
python ×2
r ×2
android ×1
cclabelttf ×1
drawing ×1
forms ×1
ggplot2 ×1
highcharts ×1
html ×1
ios ×1
java ×1
javascript ×1
jquery ×1
label ×1
loops ×1
matlab ×1
scatter-plot ×1
stata ×1
tooltip ×1
variables ×1