我沿着x轴有一个非常密集的数据集,并使用with boxes
作为直方图绘制它。我的数据表包含x轴标签的条目。 x标签变得太密集了。我怎么说让它们每10个打印一次。
plot 'histo.raw' using 3:xtic(2) with boxes lc rgb 'orange' title 'data'
示例数据:
130 " +0.145 -> +0.150" 0 0.00
131 " +0.150 -> +0.155" 0 0.00
132 " +0.155 -> +0.160" 0 0.00
133 " +0.160 -> +0.165" 1 0.00
134 " +0.165 -> +0.170" 2 0.00
135 " +0.170 -> +0.175" 2 0.00
136 " +0.175 -> +0.180" 4 0.00
137 " +0.180 -> +0.185" 9 0.01
138 " +0.185 -> +0.190" 31 0.03
139 " +0.190 -> +0.195" 74 0.07
140 " +0.195 -> +0.200" 114 0.11
141 " +0.200 -> +0.205" 126 0.13
142 " +0.205 -> +0.210" 114 0.11
143 " +0.210 -> +0.215" 120 0.12
144 " +0.215 -> +0.220" 181 0.18
145 " +0.220 -> +0.225" 216 0.22
146 " +0.225 -> +0.230" 367 0.37
147 " +0.230 -> +0.235" 503 0.50
148 " +0.235 -> +0.240" 648 0.65
149 " +0.240 -> +0.245" 788 0.79
150 " +0.245 -> +0.250" 960 0.96
如果我这样做的话。
set xtics 0,10 in rotate by 90 offset first +0.5,0 right
plot 'histo.raw' using 3 with boxes lc rgb 'orange' title 'data'
我得到了所需的间隔标签。但我的数据文件中的标签文字已经消失,只是换行计数(我不想要)
感谢您的反馈。
答案 0 :(得分:4)
只有当行号 StringRequest stringRequest = new StringRequest(Request.Method.GET, URL_PRODUCTS,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray array = new JSONArray(response);
for (int i = 0; i < array.length(); i++) {
JSONObject product = array.getJSONObject(i);
Product product1=new Product();
product1.setName(product.getString("name"));
product1.setDescription(product.getString("description"));
productList.add(product1);
}
} catch (JSONException e) {
e.printStackTrace();
}
setuprecyclerview(productList);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_SHORT).show();
}
});
//adding our stringrequest to queue
Volley.newRequestQueue(this).add(stringRequest);
} private void setuprecyclerview(List<Product> productList) {
myadapter = new ProductAdapter(this,productList) ;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(myadapter);
}
可被10整除时,您才可以将using 3:xtic(2)
替换为只生成标签的表达式:
$0